python

Breaking Bash - Using Bash in Jupyter Notebooks

Bashing something something pun Jupyter notebooks have a lot of capabilities and applications. One of the less document uses is the ability to use Bash in-line. While this power is easy enough to overlook, it’s also easy enough to misunderstand. Learning, looking, and reading about things related to the bash commands available in Jupyter Notebooks, I see a lot of people using it like this: !ls file1.csv file2.csv file3.csv pd.read_csv('./file1.csv') pd.

Walrus Operator

Using an Arctic Tank with a Data Snake What IS a Walrus? USFWS via PIXNIO, licensed under Creative Commons, CC0. Data science marine biologists rejoice! In-line assignment is possible as of Python 3.81 (released in Oct. 2019)2. The walrus operator (:=) sets a variable to a value, just like = - but importantly - IT RETURNS A VALUE. This may not seem very useful, and often times, it isn’t. However, this means that variable assignment can be done in line.