In [3]:
from IPython.display import Javascript
Javascript("""window.load_remote_theme = false; var theme_url = "https://drostehk.github.io/ipynb-theme/"; var asset_url = 'https://raw.githubusercontent.com/tijptjik/DS_assets/master/'; window.load_local_theme = function(){ var hostname = document.location.hostname; return ((hostname == "localhost" || hostname == '127.0.0.1') && !load_remote_theme)}; var url = load_local_theme() ? document.location.origin + "/files/theme/custom.js" : theme_url + 'custom.js'
$.getScript(url)""")
Out[3]:
The joy of coding Python should be in seeing short, concise, readable classes that express a lot of action in a small amount of clear code -- not in reams of trivial code that bores the reader to death.
Python comes with a rich ecosystem of 'modules' that extend the core functionality provided by the language itself. Python Anaconda is a collection of the most popular modules used for scientific computing. By installing Anaconda, you will install python and setup all the libraries used in this class.
Please follow the online install documentation for instructions.
launch the IPython Notebook by opening up a terminal and typing in the following command before pressing ENTER.
ipython notebook
Cells are either 'code' or 'text' - try to switch between them with the 'cell' menu on top. Text in cells is styled with a syntax known as MarkDown
Mac users need to run this in the terminal
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
In [ ]:
In [ ]:
In [7]:
import seaborn as sns
%matplotlib inline
sns.set()
flights_long = sns.load_dataset("flights")
flights = flights_long.pivot("month", "year", "passengers")
flights = flights.reindex(flights_long.iloc[:12].month)
sns.heatmap(flights, annot=True, fmt="d");
In [12]:
# assignement
In [ ]:
# reassignement
In [ ]:
# name error
In [13]:
# multiple assignment
In [14]:
# variable swap
In [15]:
# + addition
# - subtraction
# * multiplication
# / division
In [ ]:
# ** exponent
In [ ]:
# % remainder
In [16]:
# division
In [ ]:
# numbers : int, float
In [ ]:
# letters ++ : str
In [ ]:
# replace
In [ ]:
# split
In [17]:
# capitalize
In [ ]:
# accessing a value
In [18]:
# updating a value
In [19]:
# appending a value
In [20]:
# deleting a value
In [ ]:
# length
In [ ]:
# concatenation
In [ ]:
# repetition
In [ ]:
# iteration
In [ ]:
# reverse
In [ ]:
# sort
In [21]:
# membership
In [ ]:
# True
In [ ]:
# False
In [ ]:
# == equal to
# != not equal to
# < less than
# > greater than
# <= less than or equal to
# >= greater than or equal to
In [22]:
# How do we build on top of the basics