Python
Table of Contents
- Basics
- Useful Libraries
- sys
- os
- math
- datetime
- pickle
- argparse
- re
- Working with data
- numpy
- pandas
- matplotlib
- plotly
- Machine Learning
- scikit learn
- pytorch
- data science
Nomenclature of symbols
()
— parantheses[]
— brackets{}
— braces``
""
Get Python
Python 2 (legacy version)
python
Python 3
python3
current version: 3.7.x
macOS Installation
- brew.sh
- python.org/downloads
Python documentation
help(type)
help(print)
- type
Ctrl
+D
to quit
dir(type/variable)
dir("") # returns all keywords, functions in python
type?
type(my_variable)
IPython
run file from within ipython
%run root-hist.py
save commands to file
save {file-name} {line-numbers}
Python snippets
Make dictionary out of two lists
a_dict = dict(zip(key_list, value_list))
zip
takes iterables, aggregates them in a tuple, and returns an iterator of tuples