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.
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.
$ whoami_ In 2015 I started my professional career with a mostly-undefined IT position.
The department I was working for knew they wanted an intern but really couldn’t figure out what exactly for.
After weeks of “Look busy™” and “Put this into a spreadsheet,” they ran out of busywork. As my internship came to an end, I had managed to impress a couple of other departments heads by coding some extremely basic HTML.