conda create --name envname
conda env create -f environment.yml
conda list
%reload_ext autoreload | |
%autoreload 2 | |
import os, sys | |
import pathlib | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
%matplotlib inline |
# Assume our code has some function that is called later (possibly called multiple times). | |
# In the code below, we have a logging function, and we don't want to always use the logger. | |
# Instead of adding an `if disable_logging` line every time we log something with the logging function, | |
# we can instead just replace the logging function with a fake function that does nothing. | |
def mock_logger(*args, **kwargs): | |
pass | |
if disable_logging: | |
logger = mock_logger |
A lot of times for searches that have one main result, it will usually be the first result on the search results page, and you end up just clicking that first link. You can save time and mental capacity by using this more efficient method.
So use this if you pretty much know what you're looking for.
With the I'm Feeling Lucky keyword set to l
, just type in Alfred something like:
l wiki ontology
l github
l pytorch docs
test = { | |
383: 3.000000, | |
663: 1.000000, | |
726: 1.000000, | |
737: 9.000000, | |
833: 8.166667 | |
} | |
pd.Series(test).where(lambda x : x!=1).dropna() |
# Doing `x in df["col"]` will always look for x in the *index* of the df, not the actual column values | |
# Thus, you have to use `x in df["col"].values` instead | |
# This can be especially insidious when you're checking if a number is in a col, but that number is also in the index. | |
# If you don't use `.values` in this case, you will think the value is in the col when it actually isn't! | |
>>> df = pd.DataFrame({"a": [20, 40, 1], "b": [32, 42, 52]}) | |
>>> df | |
a b | |
0 20 32 | |
1 40 42 |