Programming Leftovers
-
University of Toronto ☛ Threads, asynchronous IO, and cancellation
Today this sparked a belated realization in my mind, which is that a model of threads performing blocking IO in each thread is simply a harder environment to have some sort of cancellation in than an asynchronous or 'event loop' environment. The core problem is that in their natural state, threads are opaque and therefor difficult to interrupt or stop safely (which is part of why Go's goroutines can't be terminated from the outside). This is the natural inverse of how threads handle state for you.
-
R
-
Rlang ☛ How to Use the duplicated Function in Base R with Examples
In data analysis, one of the common tasks is identifying and handling duplicate entries in datasets. Duplicates can arise from various stages of data collection and processing, and failing to address them can lead to skewed results and inaccurate interpretations. R, a popular programming language for statistical computing and graphics, provides built-in functions to efficiently detect and manage duplicates.
The duplicated function in base R is a powerful tool that helps identify duplicate elements or rows within vectors and data frames. This blog post will provide a comprehensive guide on how to use the duplicated function effectively, complete with practical examples to illustrate its utility.
-
Rlang ☛ forcats::fct_lump_n() with weights “overall”
Sometimes I want to summarize some categories which don’t have much impact on my analysis. So the best way to do this is using some of the forcats::fct_lump*() functions.
-
Rlang ☛ Stepwise selection of variables in regression is Evil. by @ellis2013nz
I’ve recently noticed that stepwise regression is still fairly popular, despite being well and truly frowned upon by well-informed statisticians.
-
-
Python
-
The New Stack ☛ Pandas: A Vital Python Tool for Data Scientists
Pandas aren’t just adorable bears munching on bamboo and rolling around [...]
-
Evan Hahn ☛ Python: how to change the extension of a pathlib.Path
In short: use
with_suffix
. For example,Path("foo.txt").with_suffix(".ogg") == Path("foo.ogg")
.I recently had a Python
pathlib.Path
whose extension I wanted to change. For example, I wanted to changePath("foo.txt")
toPath("foo.ogg")
.
-