Skip to content

Instantly share code, notes, and snippets.

View Tayflo's full-sized avatar
🐉
言必信,行必果。

Tayflo

🐉
言必信,行必果。
View GitHub Profile
@Tayflo
Tayflo / memo_conda_envs.md
Last active January 27, 2021 10:41
How to setup and use a local Conda environment with JupyterLab?

Setup and use a local Conda environment with JupyterLab

Motivation

When developing, you generally want to have a reproducible environment, for each project. Maybe you project is currently using numpy as 1.19 version, but what if numpy v2 is so cool that despite breaking changes you want to use it in your new projects? If you have numpy installed globally, it will be a headache: if you step up, every old projects will be un-usable (which is inconvenient); if you never step up anything, you will be stuck in 2020 forever (which is sad).

Hence, it is best practice to keep things tidy, and to have specific environment to work with for each of your projects, containing all dependencies this project needs in order to run properly. In Python, those seem to be called "virtual environments" (*seriously, across programming communities semantics can be tricky: what exactly is a module? a package? a dependency? an environmen

@Tayflo
Tayflo / r_lubridate_bce.R.md
Last active February 20, 2021 20:16
Some thoughts about Year zero and dealing with BCE dates in the Lubridate R package (v1.7.9)

Using lubridate with BCE/CE (as of v1.7.9)

Related issue: tidyverse/lubridate#2

Summary: If you are wondering about how to do deal with BCE dates in R, especially with the Lubridate R package (v1.7.9), or to implement those within the Lubridate package, here are some thoughts about problems caused by a phantom year zero.

Explanations

If anyone is considering dealing with "before common era" dates in lubridate, be aware that Year zero doesn't exist (for historians I mean, there is Year -1 and then Year 1, see for example the Wikipedia chronology – also note that's for the Julian calendar, that could have minor conflicts with the Gregorian calendar we use nowadays; you would find more details about this on Wikipedia), and that can cause a few problems.