In [1]:
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
%matplotlib inline
from pandas.tools.plotting import parallel_coordinates

In [ ]:
a


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-60b725f10c9c> in <module>()
----> 1 a

NameError: name 'a' is not defined

In [2]:
# TODO: Load up the Seeds Dataset into a Dataframe
# It's located at 'Datasets/wheat.data'
# 
# .. your code here ..

In [3]:
# TODO: Create a slice of your dataframe (call it s1)
# that only includes the 'area' and 'perimeter' features
# 
# .. your code here ..

In [4]:
df = pd.read_csv('Datasets/wheat.data')
df.head(5)


Out[4]:
id area perimeter compactness length width asymmetry groove wheat_type
0 0 15.26 14.84 0.8710 5.763 3.312 2.221 5.220 kama
1 1 14.88 14.57 0.8811 5.554 3.333 1.018 4.956 kama
2 2 14.29 14.09 0.9050 5.291 3.337 2.699 4.825 kama
3 3 13.84 13.94 0.8955 5.324 3.379 2.259 4.805 kama
4 4 16.14 14.99 0.9034 5.658 3.562 1.355 5.175 kama

In [5]:
dfsli1 = df[['area','perimeter']]
dfsli1.head(5)


Out[5]:
area perimeter
0 15.26 14.84
1 14.88 14.57
2 14.29 14.09
3 13.84 13.94
4 16.14 14.99

In [6]:
# TODO: Create another slice of your dataframe (call it s2)
# that only includes the 'groove' and 'asymmetry' features
# 
# .. your code here ..

In [7]:
dfsli2 = df[['groove','asymmetry']]
dfsli2.head(5)


Out[7]:
groove asymmetry
0 5.220 2.221
1 4.956 1.018
2 4.825 2.699
3 4.805 2.259
4 5.175 1.355

In [8]:
# TODO: Create a histogram plot using the first slice,
# and another histogram plot using the second slice.
# Be sure to set alpha=0.75
# 
# .. your code here ..


# Display the graphs:

In [9]:
# Look pretty...
# matplotlib.style.use('ggplot')
plt.style.use('ggplot')
dfsli1.plot.hist(alpha = 0.75)


Out[9]:
<matplotlib.axes._subplots.AxesSubplot at 0x197b3d3b048>

In [10]:
dfsli2.plot.hist(alpha = 0.75)


Out[10]:
<matplotlib.axes._subplots.AxesSubplot at 0x197b41b7e10>

In [11]:
df.plot.scatter(x = 'area', y = 'perimeter')


Out[11]:
<matplotlib.axes._subplots.AxesSubplot at 0x197b42a5a58>

In [12]:
df.plot.scatter(x = 'groove', y = 'asymmetry')


Out[12]:
<matplotlib.axes._subplots.AxesSubplot at 0x197b42f2be0>

In [13]:
df.plot.scatter(x = 'compactness', y = 'width')


Out[13]:
<matplotlib.axes._subplots.AxesSubplot at 0x197b43592e8>

In [14]:
from mpl_toolkits.mplot3d import Axes3D

In [15]:
fig = plt.figure()
ax = fig.add_subplot(111, projection = '3d')
ax.set_xlabel('area')
ax.set_ylabel('perimeter')
ax.set_zlabel('asymmetry')
ax.scatter(df.area, df.perimeter, df.asymmetry, c='red', marker='*')


Out[15]:
<mpl_toolkits.mplot3d.art3d.Path3DCollection at 0x197b546f278>

In [16]:
fig = plt.figure()
ax = fig.add_subplot(111, projection = '3d')
ax.set_xlabel('width')
ax.set_ylabel('groove')
ax.set_zlabel('length')
ax.scatter(df.width, df.groove, df.length, c='green', marker='*')


Out[16]:
<mpl_toolkits.mplot3d.art3d.Path3DCollection at 0x197b59450f0>

In [17]:
del df['id']
plt.figure()
parallel_coordinates(df, 'wheat_type')


Out[17]:
<matplotlib.axes._subplots.AxesSubplot at 0x197b5965b00>