Jupyter Notebooks (US Wk 3) Flashcards
How to open a jupyter notebook?
Anaconda command prompt: jupyter notebook (opens in browser)
reference the output of the last executed cell
underscore. _ * 3»_space; last output * 3
Keyboard shortcut to switch arrows from navigating in a cell to navigating amongst cells
Esc from within the cell, then “enter” to enter a cell
What is a markdown cell in a jupyter notebook?
Allows you to format using headings, bold, latex equations, lists, etc
How do you save a non-executable version of the notebook?
File save as – HTML
execute unix command in notebook, eg ls directory
!ls . (exclamation point before)
store the filename in a variable
filename = ‘filename.txt’
unix command to count the number of lines in the file, w/ var filename
!wc -l $filename (need the $ on the variable)
unix command to get the value of variable filename
!echo $filename
count the lines in a filename with word liberty
!grep -o ‘liberty’ $filename | wc -l
replace blueberries with apples and output to a new file
!sed -e ‘s/Apples/Blueberries/g’ ‘fruits2.txt’ > fruits3.txt