The import keyword is used to import a library

In [2]:
import math
print(math.cos(math.pi / 2))

6.123233995736766e-17

Pandas

In [1]:
import numpy
import pandas
rows = ['line1', 'line2', 'line3', 'line4', 'line5']
cols = ['col1', 'col2', 'col3', 'col4']
from IPython.display import display
dataframe = pandas.DataFrame(numpy.random.randn(5,4), index=rows, columns=cols)
display(dataframe)
col1 col2 col3 col4
line1 -0.882125 2.176452 0.163955 -0.618232
line2 -0.721538 0.035578 0.180072 1.015987
line3 -1.162355 0.384632 -0.674092 0.162693
line4 -1.399455 -0.698512 0.039420 0.898408
line5 1.755342 -0.073242 -1.502503 -0.586194

reorganise a dataframe from datas as a dictionary with tuples as keys

In [2]:
dico = {('john', 'Snow') : 12, ('Paul', 'Durand') : 13, ("Pierre", "Dupont") : 16, ("Cerise", "Lanister") : 14}
import pandas
df = pandas.Series(dico).reset_index()
df.columns = ['Column 1', 'Column 2', 'Column 3']
from IPython.display import display
display(df)
Column 1 Column 2 Column 3
0 Cerise Lanister 14
1 Paul Durand 13
2 Pierre Dupont 16
3 john Snow 12