Welcome to The Carpentries Etherpad! This pad is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents. Use of this service is restricted to members of The Carpentries community; this is not for general purpose use (for that, try https://etherpad.wikimedia.org). Users are expected to follow our code of conduct: https://docs.carpentries.org/topic_folders/policies/code-of-conduct.html All content is publicly available under the Creative Commons Attribution License: https://creativecommons.org/licenses/by/4.0/ ---------------------------------------------------------------------------- *Links * Website: https://nclrse-training.github.io/2021-04-26-NCL-ONLINE * Pre-workshop survey: https://carpentries.typeform.com/to/wi32rS?slug=2021-04-26-NCL-ONLINE * Post-workshop survey: https://carpentries.typeform.com/to/UgVdRQ?slug=2021-04-26-NCL-ONLINE *Logins JupyterHub logins will be pasted here on the day of the workshop: Use your student or staff number to log in. The first time you log in you need to enter a password. Pick any password. If you forget what your password is please let us know in the Zoom chat. How To: Go to op.jannetta.com in an internet browser. You will be prompted to enter a username - use your university one to log in. Once on there you can click the 'new' dropdown on the right hand side and select 'terminal' to start a shell session. When in the shell, type (or copy/paste) : wget https://swcarpentry.github.io/shell-novice/data/data-shell.zip This will load in the files that we will be using during the shell carpentry session. This will initially be compressed in a zip, so to unzip type the following command: unzip data-shell NB: terminal/console/shell are all used for the same interface. Using a terminal/ shell offline on your computer (i.e. not using jupyter-hub): On linux or mac search for terminal in applications and you should be able to launch it straight from your applications list On windows, you will need to use 'git-bash' or a similar port of the linux terminal (the windows has its own command line which uses different syntax). Instructions for installing this can be found: https://swcarpentry.github.io/shell-novice/setup.html *Lessons *Day 1 - Unix Shell Day 1 (26 April 2021) *End of day survey: *What have we done well? 1. great communication 2. lots of opportunity to ask questions 3. Stuart's cheat sheet extremely helpful 4. A really interesting session and understandable for someone with no prior knowledge! Also love the cheat sheet and the course notes. Interactive activities are really helpful. 5. great to follow along with frances on screen 6. Great presentation and communication. *What can we improve on? 1. Please could you point out where the notes are at the start as I think it's useful to have them so you know how many notes you need to take :) 2. 3. 4. *Day 2 - Unix Shell Day 1 (27 April 2021) *End of day survey: *What have we done well? 1. Lots of practical exercises/examples 2. The exercises really made you think about how to apply what we'd learned so far! 3. 4. 5. 6. *What can we improve on? 1. Have the flags already in a cheat sheet from start as there are so many 2. 3. 4. *Day 3 - Version Control with GIT(28 April 2021) *End of day survey: *What have we done well? 1. Lots of great examples again! They really help the learning sink in 2. 3. 4. 5. 6. *What can we improve on? 1. Maybe we could have registered for GitHub in advance, might have saved a bit of time 2. 3. 4. 5. *Day 4 - Programming with Python Part 1 (29 April 2021) http://op.jannetta.com/ https://swcarpentry.github.io/python-novice-gapminder/ Setup page is focused on local install, however we recommend and have set up users for everyone on the server jupyter hub op.jannetta.com, the colours and layout will be slightly different but it's the same functionality 1) https://swcarpentry.github.io/python-novice-gapminder/01-run-quit/index.html 2) https://swcarpentry.github.io/python-novice-gapminder/02-variables/index.html 3) https://swcarpentry.github.io/python-novice-gapminder/03-types-conversion/index.html 4) https://swcarpentry.github.io/python-novice-gapminder/04-built-in/index.html 5) COFFEE BREAK 6) https://swcarpentry.github.io/python-novice-gapminder/06-libraries/index.html 7) https://swcarpentry.github.io/python-novice-gapminder/07-reading-tabular/index.html 8) https://swcarpentry.github.io/python-novice-gapminder/08-data-frames/index.html 9) https://swcarpentry.github.io/python-novice-gapminder/09-plotting/index.html Data http://swcarpentry.github.io/python-novice-gapminder/files/python-novice-gapminder-data.zip *End of day survey: Note for next session, session doesn't cover pandas install, errors when everyone trying to install pandas all at once on the server - install pandas on all user accounts prior to session starting importing pandas error -> module not found *What have we done well? 1. Great examples again, I really like the example based working (even if it doesn't always go to plan...) 2. Good pace, clear explanations 3. 4. 5. *What can we improve on? 1. 2. 3. 4. 5. *Cheat Sheet *Unix Shell Important Notes To leave a man page or less, view press q to leave. To leave nano, type CTRL-X followed by y (if you want to save, otherwise n) then enter. If you ever get stuck in vi editor, simply press ESCAPE, then type :q followed by enter to leave without saving. If you run a command and want to force it to stop type CTRL-C *Unix Shell Commands Most commands in Unix Shell will have one of the following options to show a help menu: *$ [command] -h *$ [command] -? *$ [command] --help Print working directory: *$ pwd List files in current working directory: *$ ls Show types: *$ ls -F List recursively (show contents of directories as well): *$ ls -R Show hidden files (usually prefixed with .): *$ ls -a List files in [directory]: *$ ls [directory] Clear terminal screen: *$ clear Show manual for [command] (highlights usage and possible optional parameters): *$ man [command] There are also online man pages if the terminal ones are unavailable to you: https://linux.die.net/man/ Change working directory: *$ cd [directory] Go to home directory *$ cd or *$ cd ~ Go to previous (parent) directory: *$ cd .. Make new directory of name [directory] in current working directory: *$ mkdir [directory] Make new nested directory: *$ mkdir -p [directory1]/[directory2]/[directory3] Create empty file without opening; *$ touch [filename] Create / read / edit files (recommended): *$ nano [filename] More powerful, but far less intuitive You may see some instructors use this (not recommended): *$ vi [filename] Change filename or move file elsewhere (this will overwrite any existing file named [new_filename]): *$ mv [original_filename] [new_filename] Move file into directory without changing the name: *$ mv [filename] [directory] Give warning when [new_filename] exists: *$ mv -i [original_filename] [new_filename] Move multiple files to new directory: *$ mv [file1] [file2] ... [new_directory] Copy file to new location / name: *$ cp [original_file] [new_file] Remove file / empty directory: *$ rm [filename] Remove directory and all of its contents (recursive): *$ rm -r [directory] Safe remove recursively: *$ rm -ri [directory] Print contents of file to terminal: *$ cat [filename] Print line / word / bytes count of [filename] *$ wc [filename] Print just the line count: *$ wc -l [filename] Print just the word count: *$ wc -w [filename] Print just the bytes count: *$ wc -c [filaname] Print just the character count: *$ wc -m [filename] Redirect output of a command to a file (this will overwrite existing contents of the file): *$ [command] > [filename] Append output of a command to a file: *$ [command] >> [filename] Redirect output of a command to the input of another command (this will replace the first fixed argument of [command2]): *$ [command1] | [command2] Open file in read only mode (similar to reading a man page): *$ less [filename] Print contents of file to terminal, sorted numerically: *$ sort -n [filename] Print only the first [n] lines of a file: *$ head -n [n] [filename] Print only the last [n] lines of a file: *$ tail -n [n] [filename] Print text to command line: *$ echo [text] For loop with predefined elements: *$ for thing in thing1 thing2 thing3 *> do *> echo $thing *> done :: This will print the following *thing1 *thing2 *thing3 For loop in one line: *$ for thing in thing1 thing2; do echo $thing; done :: this will print the following *thing1 *thing2 For loop with wildcard: *$ for filename in *.txt *> do *> echo $filename *> done :: This will print all file names in the current working directory which end with .txt Seperate content of lines in the file [filename] by [delimeter] and return only element [field] from the list: *$ cut -d [delimeter] -f [field] [filename] Cut for multiple fields: *$ cut -d [delimeter] -f [field1],[field2],... [filename] e.g. ::Command *$ cut -d , -f 2 stuff.txt ::File (stuff.txt) *thing1,thing2,thing3 *thingy1,thingy2,thingy3 ::Output *thing2 *thingy2 Search for string [regex] in file [filename]: *$ grep [regex] [filename] Search with case insensitivity: *$ grep -i [regex] [filename] Match only lines containing [text] as a full word (rather than part of one): *$ grep -w [regex] [filename] Show line numbers as well: *$ grep -n [regex] [filename] Show lines that don't contain [text]: *$ grep -v [regex] [filename] Search in multiple files: *$ grep -r [regex] [filenames] Find all files under [directory]: *$ find [directory] Find all files matching [regex]: *$ find [directory] -name [regex] Use output of [command2] as specific input to [command1]: [command1] $([command2]) e.g. grep "something" $(find . -name *.txt) ::This will find all lines containing "something" in all text files under the working directory *Unix Shell Scripts Reference to command line inputs (where n is the order of the input): *$n e.g. ::Script (script.sh) *echo "$1" is cooler than "$2" ::Command *$ bash script.sh Linux Windows ::Output *Linux is cooler than Windows Reference to all command line inputs as a list: *$@ Comments (Text that is not executed): *# Comment *Unix Shell Regular Expressions (Wildcards) *Wildcards *+----------------------+--------+-----------------+-----------------+-----------------+ *| Description | Symbol | Example | Match | Not Match | *+----------------------+--------+-----------------+-----------------+-----------------+ *| Trailing Wildcard | * | myfile* | myfile.txt | notmyfile | *| | | | myfile | yourfile.txt | *+----------------------+--------+-----------------+-----------------+-----------------+ *| Leading Wildcard | * | *.txt | myfile.txt | myfile.dat | *| | | | .txt | myfile.txtt | *+----------------------+--------+-----------------+-----------------+-----------------+ *| Embedded Wildcard | * | ILike*Alot | ILikeBreadAlot | ILikeBread | *| | | | ILikeAlot | | *+----------------------+--------+-----------------+-----------------+-----------------+ *| Wildcard Character | ? | myfile?.txt | myfile1.txt | myfile123.txt | *| | | | | myfile.txt | *+----------------------+--------+-----------------+-----------------+-----------------+ *Grep *+----------------------+--------+-----------------+-----------------+-----------------+ *| Description | Symbol | Example | Match | Not Match | *+----------------------+--------+-----------------+-----------------+-----------------+ *| Start of line | ^ | ^hello | hello there | why hello there | *+----------------------+--------+-----------------+-----------------+-----------------+ *| End of line | $ | goodbye$ | ok, goodbye | ok, goodbye! | *+----------------------+--------+-----------------+-----------------+-----------------+ *| Any single character | . | h.t | hit | heat | *| | | | hat | ht | *+----------------------+--------+-----------------+-----------------+-----------------+ *| Character classes | [] | h[ia] | hit | hut | *| | | | hat | hot | *+----------------------+--------+-----------------+-----------------+-----------------+ *| One or more of a | + | me+t | met | mt | *| character | | | meet | mat | *+----------------------+--------+-----------------+-----------------+-----------------+ *| Zero or more of a | * | ye*t | yt | yot | *| character | | | yeet | | *+----------------------+--------+-----------------+-----------------+-----------------+ *| Alternatives (or) | | | yes|no | I said yes | I didn't say | *| | | | I said no | I did say | *+----------------------+--------+-----------------+-----------------+-----------------+ In order to use a character which is predefined as a special character (e.g. period ., square parentheses [, etc.) prefix it with a backslash \. e.g. ::Regex *Hello\. ::Matches *Hello. How are you? ::Doesn't Match *Hello there! *Git Commands *Local Commands Set git username to [name]: *$ git config --global user.name "[name]" Set git email to [email]: *$ git config --global user.email "[email]" Set github to use correct line endings (non Windows): $ git config --global core.autocrlf input Set github to use correct line endings for Windows): *$ git config --global core.autocrlf true Set default git editor to nano: *$ git config --global core.editor "nano -w" List settings: *$ git config --list Initialise current working directory as a git repository: *$ git init To delete a git repository simply delete the .git directory. This will lose the version history, but existing files will remain. Show general status of a git repository: *$ git status Show commit history (this shows commit message, author, datetime of commit, and commit hash): *$ git log Show only [n] commits: *$ git log -[n] Show more detailed log of changes in each commit: *$ git show Show all changes since last commit: *$ git diff Show changes in file [filename] since commit [commit]: *$ git diff [commit] [filename] Stage changes in file [filename] for commit: *$ git add [filename] Stage all changes in the repository for commit: *$ git add . Empty directories will not be tracked. They will be tracked once a file within the directory is tracked. Save changes to the local repository with the message [message]: *$ git commit -m "[message]" Commit messages should be informative but concise. They should give a general idea of the changes made. Change repository to previous version: *$ git checkout [commit] Return to most recent version: *$ git checkout HEAD Change specific file to previous version: *$ git checkout [commit] [filename] *Remote Commands Link local repository with remote: *$ git remote add origin [url] View current remote url: *$ git remote -v Copy repository from remote to local: *$ git clone [url] Push commits to remote: *$ git push If you run this for the first time on a branch you may be asked to type: *$ git push --set-upstream origin main If neither work you can always type: *$ git push origin main You may see some repositories use master instead of main. This is due to a recent change in naming conventions. It is now preferable to use main rather than master. Update local repository with any changes in remote: *$ git pull *Commit References Most recent commit: *HEAD Commit before most recent commit: *HEAD~1 [n]th commit before most recent commit: *HEAD~[n] You can use 'git log' to find the unique identifier for a commit (commit hash). This will be a seemingly random sequence of characters. You usually only need to type about 5 characters (more for larger repositories) of the hash. *Gitignore In the root directory of your repository you can create a file by the name ".gitignore", in which you can name any files you don't want to be tracked. Gitignore will work with Unix Wildcards, so putting the following in a gitignore file: **.txt Will exclude all files ending with ".txt". To ignore all files in a directory you can enter: *[directory]/* *Jupyter *Keyboard Shortcuts DC = double click b - New cell below selected a - New cell above selected x - Delete selected cell z - Undo last operation ESC - Enter command mode Enter - Enter edit mode Shift+Enter - Run selected cell DC 0 - Restart all cells *Markdown *# Header 1 *## Header 2 *### Header 3 * *. Bullet point * *1. Numbered list 1 *2. Numbered list 2 *Python *Variables Save value [value] into variable named [var]: *>>> [var] = [value] :: Variable names must only contain [A-Za-z0-9_], and must begin with [A-Za-z_] :: If you want to use multiple words, use an underscore instead of a space e.g. *>>> my_variable :: Variable names are case-sensitive e.g. *>>> myvariable is different to *>>> myVariable Integers (int) - Whole numbers e.g. *>>> x = 10 Floats (float) - Decimal numbers e.g. *>>> x = 3.14159 String (str) - Text e.g. *>>> x = "Hello world" *>>> x = 'Good evening' Lists (list) - Sequence of values e.g. *>>> x = [] *>>> x = [1, 2, 3] *>>> x = ["a", "b", "c"] *>>> x = [1, "b", "c", 4] Tuples (tuple) - An immutable list (values cannot be changed after assignment) e.g. *>>> x = tuple() *>>> x = (1, 2, 3) *>>> x = ("a", "b", "c") *>>> x = (1, "b", "c", 4) *List / String Operations The following operations can apply to both lists and strings: * *>>> my_string = "Hello World" *>>> my_list = [10, 20, 30, 40, 50] Select specific element at {index}: *>>> {list}[{index}] :: python indexes from 0 e.g. *>>> my_string[0] *"H" *>>> my_string[4] *"o" :: Indexing from a negative number will index from the end of the list e.g. *>>> my_string[-1] *"d" *>>> my_string[ *"r" Select subset between {i1} and {i2} (splicing): *>>> {list}[{i1}:{i2}] e.g. *>>> my_string[3: 8] *"lo W" :: Omitting an index will go to that end of the list e.g. *>>> my_string[3:] *"lo World" *>>> my_string[:8] *"Hello Wo" *>>> my_string[:] *"Hello World" Join two or more lists/strings (concatenation): *>>> {list1} + {list2} e.g. *>>> my_string + "!" *"Hello World!" *>>> my_list + my_list *[10, 20, 30, 40, 50, 10, 20, 30, 40, 50] Concatenate list/string to itself {n} times: *>>> {list} * {n} e.g. *>>> my_string * 2 *"Hello WorldHello World" Split string into list, separating each element by a delimeter: *>>> {string}.split({delimeter}) Convert list to string with delimeter between values (use "" for no delimeter): *>>> {delimeter}.join({list}) List Only Append element to the end of a list: *>>> {list}.append({element}) Insert element into the middle of a list: *>>> {list}.insert({index}, {element}) Remove element from list: *>>> del {list}[{index}] Remove first instance of element from list: *>>> {list}.remove({element}) 2d lists / nested lists / lists within lists: e.g. *>>> my_2d_list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] *>>> print(my_2d_list[0]) *[1, 2, 3] *>>> print(my_2d_list[0][1]) *2 *Operators Addition: *>>> 1 + 1 *2 Subtraction: *>>> 10 - 5 *5 Multiplication: *>>> 13 * *26 Division: *>>> 20 / 5 *4 Powers / Indices: *>>> 2 ** 3 8 Strict Integer division: *>>> 20.25 // 5.0 4.0 Remainder (modulo): *>>> 27 % 8 *3 Complex numbers: *>>> 1 + 2j *(1+2j) Greater than: *>>> 5 > 4 *True *>>> 4 > 5 *False *>>> "b" > "a" *True Less than: *>>> 4 < 5 *True *>>> 5 < 4 *False *>>> "a" < "b" *True Greater than or equal to: *>>> 5 >= 4 *True *>>> 5 >= 5 *True *>>> 5 >= 6 *False Less than or equal to: *>>> 5 <= 6 *True *>>> 5 <= 5 *True *>>> 5 <= 4 *False Equal to: *>>> 5 == 5 *True *>>> 5 == 4 *False Not equal to: *>>> 5 != 4 *True *>>> 5 != 5 *False And: *>>> True and True *True *>>> False and True False *>>> True and False False *>>> False and False *False Or: *>>> True or True *True *>>> False or True *True *>>> True or False *True *>>> False or False *False Not: *>>> not True *False *>>> not False *True *Statements Statements work with indentation. The contents of a given statement should be indented (usually 4 spaces), and to exit the bounds of a statement you exclude the indentation. *>>> {statement}: *>>> # Do something *>>> # in statement *>>> # Do something out statement For Loops Iterate through a list: *>>> for {element} in {list}: *>>> # Do something e.g. *>>> for num in [1, 2, 3]: *>>> print(num ** 2) *1 *4 *9 *>>> for char in "Hello": *>>> print(char) *"H" *"e" *"l" *"l" *"o" While Loops Iterate until {condition} is true: *>>> while {condition}: *>>> # Do something e.g. *>>> x = 0 *>>> while x < 5: *>>> x += 1 *>>> print(x) *1 *2 *3 *4 *5 If Statements Only do something if {condition} is True: *>>> if {condition}: *>>> # Do something e.g. *>>> print("Is 10 > 5?") *>>> if 10 > 5: *>>> print("Yes!") *Is 10 > 5? *Yes! *>>> print("Is 10 > 15") *>>> if (10 > 15): *>>> print("Yes!") *Is 10 > 15? Do something if {condition} is True, otherwise do something else: *>>> if {condition}: *>>> # Do something *>>> else: *>>> # Do something else Check for multiple conditionals (if a is not true, check if b is true): *>>> if {condition1}: *>>> # Do something *>>> elif {condition2: *>>> # Do something else ::This can be extended endlessly *>>> if {condition1}: *>>> # Do thing 1 *>>> elif {condition2}: *>>> # Do thing 2 *>>> elif {condition3}: *>>> # Do thing 3 *... *>>> else: *>>> # Do final thing *Functions *>>> def {function_name}({function_parameters}): *>>> # Do something e.g. *>>> def hello(): *>>> print("Hello") *>>> hello() *Hello *>>> def greeting(name): *>>> print("Hello", name) *>>> greeting("Fransozich Vastoban III") *Hello Fransozich Vastoban III Set default value on parameter: *>>> def {function_name}({parameter}={default}): *>>> # Do something e.g. *>>> def greeting(name="World"): *>>> print("Hello", name) *>>> greeting() *>>> greeting("Sir Augustus Valio-Maximillion IV") *Hello World *Hello Sir Augustus Valio-Maximillion IV Return value from function: *>>> def {function_name}({parameters}): *>>> # Do something *>>> return {value} e.g. *>>> def square(n): *>>> return n * n *>>> x = 5 *>>> x2 = square(x) *>>> print(x, "squared is", x2) *5 squared is 25 Add help comments to a function (docstring): *>>> def {function_name}({parameters}): *>>> "{help_message}" Add multiple lines: *>>> def {function_name}({parameters}): *>>> """ *>>> {help_message_line1} *>>> {help_message_line2} *>>> ... *>>> """ *Commands Display message {message} in the console: *>>> print({message}) :: Passing multiple values into print will display the messages with spaces separating them: *>>> print({message1}, {message2} e.g. *>>> print("Hello World") *"Hello World" *>>> print("Hello", "World") *"Hello World" Get the maximum of a sequence of values: *>>> max({list}) *>>> max({val1}, {val2}, ...) Get the minimum of a sequence of values: *>>> min({list}) *>>> min({val1}, {val2}, ...) Get the length of a list or string: *>>> len({list}) Round number to nearest integer: *>>> round({value}) Round to {precision} decimal places: *>>> round({value}, {precision}) Generate list of ordered numbers ({max} is exclusive): *>>> range({max}) *>>> range({min}, {max}) *>>> range({min}, {max}, {step}) :: The range type is separate to the list type. These are effectively specially designed lists for working with loops. If necessary you can convert a range to a list like so: *>>> list({range}) Get type of {value}: *>>> type({value}) e.g. *>>> type(3.4) * *>>> type("Pneumonoultramicroscopicsilicovolcanoconiosis") * Convert {value} to an integer: *>>> int({value}) e.g. *>>> int(1) *1 *>>> int(5.5) *5 *>>> int(-5.5) -5 *>>> int("12") *12 Convert {value} to a float: *>>> float({value}) e.g. *>>> float(1) *1.0 *>>> float(5.5) *5.5 *>>> float("10.25") *10.25 Convert {value} to a string: *>>> str({value}) e.g. *>>> str(1) *"1" *>>> str([1, 2, 3]) *"[1, 2, 3]" *>>> str("Antidisestablishmentarianism") *"Antidisestablishmentarianism" Convert {value} to a list: *>>> list({value}) e.g. *>>> list([1, 2, 3]) *[1, 2, 3] *>>> list("abc") *["a", "b", "c"] *Libraries Import a library *>>> import {library} e.g. *>>> import this Import with an alias *>>> import {library} as {alias} e.g. *>>> import numpy as np ::Some libraries have conventional aliases people recommend to use (e.g. numpy as np, pandas as pd, matplotlib as mpl, matplotlib.pyplot as plt, etc.) Import specific function from library: *>>> from {library} import {function} e.g. *>>> from math imprt sqrt Math *>>> import math Approximation of pi: *>>> math.pi *3.141592653589793 Trigonometry functions: *>>> math.sin({x}) *>>> math.cos({x}) *>>> math.tan({x}) *>>> math.asin({x}) *>>> math.acos({x}) *>>> math.atan({x}) Common math functions: *>>> math.pow({x}, {index}) *>>> math.sqrt({x}) *>>> math.floor({x}) *>>> math.ceil({x}) Random *>>> import random Random number between 0 and 1: *>>> random.random() Random integer between two values: *>>> random.randint({start}, {end}) Random integer between two values (exclusive end point): *>>> random.randrange({start}, {end}) *>>> random.randrange({start}, {end}, step={step}) Shuffle values of a list: *>>> random.shuffle({list}) Randomly select {n} values from {list}: *>>> random.sample({list}, {n}) Glob *>>> import glob List all files matching unix-style regex: *>>> glob.glob("{regex}") Pandas *>>> import pandas as pd Convert csv file {filename} into dataframe: *>>> pd.read_csv({filename}) Specify index column: *>>> pd.read_csv({filename}, index_col={column}) Get general description of a dataframe {data}: *>>> {data}.info() Get A list of columns from a dataframe: *>>> {data}.columns Show general statistics for a dataframe: *>>> {data}.describe() Invert x-y axis of a dataframe: *>>> {data}.T *>>> {data}.transpose() Get First {n} columns: *>>> {data}.head(n={n}) Get Last {n} columns: *>>> {data}.tail(n={n}) Retrieve specific value from dataframe by index: *>>> {data}.iloc[{row}, {column}] Retrieve specific value from dataframe by row/column name: *>>> {data}.loc[{row_name}, {column_name}] Retrieve all rows for a given column: *>>> {data}.iloc[:, {column}] *>>> {data}.loc[:, {column_name}] Retrieve all columns for a given row: *>>> {data}.iloc[{row}] *>>> {data}.loc[{row_name}] Retrieve rows and columns within a range (exclusive end): *>>> {data}.iloc[{row_start}:{row_end}, {column_start}:{column_end}] Retrieve rows and columns within a range (completely inclusive): *>>> {data}.loc[{row_start_name}:{row_end_name}, {column_start_name}:{column_end_name}] Get minimum value for each row in a dataframe: *>>> {data}.min() Conditionals can be used on a dataframe, and will be applied to all elements e.g. *>>> my_data = pd.DataFrame([[1, 2, 3, 4], [5, 6, 7, 8]]) * 0 1 2 3 *0 1 2 3 4 *1 5 6 7 8 *>>> my_data > 3 * 0 1 2 3 *0 False False False True *1 True True True True Passing a conditional dataframe can ask as a mask, filtering out values marked as false: *>>> my_data[my_data > 3] * 0 1 2 3 *0 NaN NaN NaN 4 *1 5 6 7 8 Plot graph of dataframe: *>>> {data}.plot() Matplotlib *>>> import matplotlib as mpl *>>> import matplotlib.pyplot as plt Show plot (not needed in jupyter): *>>> plt.show() Plot line graph: *>>> plt.plot({x_list}, {y_list}) *>>> plt.plot({dataframe}) Set axis labels: *>>> plt.xlabel({xlabel}) *>>> plt.ylabel({ylabel})