In [1]:
%matplotlib inline
import pandas as pd
from matplotlib import *
In [2]:
# Iris dataset
df = pd.read_csv('../datasets/iris.csv')
df
Out[2]:
In [3]:
# Pie chart on species
from pylab import *
df['Species'].unique()
Out[3]:
In [4]:
labels = df['Species'].unique()
counts = []
for label in labels:
counts.append(len(df[label == df['Species']]))
counts
Out[4]:
In [5]:
figure(1, figsize=(6,6))
ax = axes([0.1, 0.1, 0.8, 0.8])
pie(counts, labels=labels)
Out[5]:
In [6]:
df['SepalLength'].unique()
Out[6]:
In [7]:
hist(df['SepalLength'])
show()
In [12]:
hist(df['SepalWidth'])
show()
In [13]:
# all histograms
hist(df['SepalWidth'])
hist(df['PetalLength'])
hist(df['PetalWidth'])
show()
In [14]:
# scatter plots
scatter(df['SepalLength'],df['SepalWidth'])
show()
In [15]:
scatter(df['PetalWidth'],df['PetalLength'])
show()
In [16]:
scatter(df['SepalWidth'], df['PetalWidth'])
show()
In [17]:
scatter(df['SepalLength'], df['PetalLength'])
show()
In [18]:
scatter(df['SepalLength'], df['PetalWidth'])
show()
In [19]:
scatter(df['SepalWidth'], df['PetalLength'])
show()
In [ ]: