I tried to run one example in the book of Python Data Science Essential. But, it appeared errors when I ran it. Actually, I just began learning the python. So, I felt that it is hard to fix those errors. Please help me. Here is code:
In:
import pandas as pd
import numpy as np
In: colors = list()
In: palette = {0: "red", 1: "green", 2: "blue"}
In:
for c in np.nditer(iris.target): colors.append(palette[int(c)])
# using the palette dictionary, we convert
# each numeric class into a color string
In: dataframe = pd.DataFrame(iris.data,
columns=iris.feature_names)
In: scatterplot = pd.scatter_matrix(dataframe, alpha=0.3,
figsize=(10, 10), diagonal='hist', color=colors, marker='o',
grid=True)
Here is errors:
ValueError Traceback (most recent call last) in () 1 scatterplot = pd.scatter_matrix(dataframe, alpha=0.3, ----> 2 figsize=(10, 10), diagonal='hist', color=colors, marker='o',grid=True)
/Users/leeivan/anaconda/lib/python2.7/site-packages/pandas/tools/plotting.py in scatter_matrix(frame, alpha, figsize, ax, grid, diagonal, marker, density_kwds, hist_kwds, range_padding, **kwds) 378 379 ax.scatter(df[b][common], df[a][common], --> 380 marker=marker, alpha=alpha, **kwds) 381 382 ax.set_xlim(boundaries_list[j])
/Users/leeivan/anaconda/lib/python2.7/site-packages/matplotlib/init.pyc in inner(ax, *args, **kwargs) 1817
warnings.warn(msg % (label_namer, func.name), 1818
RuntimeWarning, stacklevel=2) -> 1819 return func(ax, *args, **kwargs) 1820 pre_doc = inner.doc 1821 if pre_doc is None:/Users/leeivan/anaconda/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs) 3787
facecolors = co 3788 if c is not None: -> 3789 raise ValueError("Supply a 'c' kwarg or a 'color' kwarg" 3790 " but not both; they differ but" 3791 " their functionalities overlap.")ValueError: Supply a 'c' kwarg or a 'color' kwarg but not both; they differ but their functionalities overlap.