In [1]:
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
%matplotlib inline
from pandas.tools.plotting import parallel_coordinates
In [ ]:
a
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]:
In [5]:
dfsli1 = df[['area','perimeter']]
dfsli1.head(5)
Out[5]:
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]:
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]:
In [10]:
dfsli2.plot.hist(alpha = 0.75)
Out[10]:
In [11]:
df.plot.scatter(x = 'area', y = 'perimeter')
Out[11]:
In [12]:
df.plot.scatter(x = 'groove', y = 'asymmetry')
Out[12]:
In [13]:
df.plot.scatter(x = 'compactness', y = 'width')
Out[13]:
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]:
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]:
In [17]:
del df['id']
plt.figure()
parallel_coordinates(df, 'wheat_type')
Out[17]: