Hello World!
Un-attributed images in the presentation are author's own creation. To use them, check the attributions here: https://github.com/sara-02/khalaq
In [70]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
#so that we can view the graphs inside the notebook
In [71]:
df = pd.read_csv("wine.csv")
df.head(3)
Out[71]:
In [51]:
df.head()
Out[51]:
In [52]:
df.tail()
Out[52]:
In [73]:
df['deaths'].count()
Out[73]:
In [54]:
df['deaths'].min()
Out[54]:
In [55]:
df['deaths'].max()
Out[55]:
In [56]:
df['deaths'].mean()
Out[56]:
In [58]:
df['deaths'].describe()
Out[58]:
In [59]:
df['deaths'].plot(kind='box')
Out[59]:
In [75]:
num = range(1,6)
mul2 = [x*2 for x in num]
mul3 = [x*3 for x in num]
mul4 = [x*4 for x in num]
mul5 = [x*35 for x in num]
data = [num, mul2, mul3, mul4, mul5]
df1 = pd.DataFrame(data, index=['v', 'w', 'x', 'y', 'z'], columns=['A', 'B','C','D', 'E'])
In [76]:
df1
Out[76]:
In [77]:
#### Only Column
df1[['A']]
Out[77]:
In [69]:
#### Only Row
df1.loc[['v']]
Out[69]:
In [64]:
df1.loc[['v','w'],['A','B']] # rows and columns
Out[64]:
In [65]:
df1.iloc[0:2, 0:2] #Using default index numbers
Out[65]:
In [78]:
df.groupby('country')['deaths'].mean().plot(kind='bar')
Out[78]: