In [4]:
%matplotlib inline
#良、恶性肿瘤预测样例
import pandas as pd
import matplotlib.pyplot as plt

#调用pandas工具包读取csv文件
df_train=pd.read_csv('/Users/wizardholy/Documents/pywork/datasets/Breast-Cancer/breast-cancer-train.csv')
df_test=pd.read_csv('/Users/wizardholy/Documents/pywork/datasets/Breast-Cancer/breast-cancer-test.csv')
df_test_negative=df_test.loc[df_test['Type']==0][['Clump Thickness','Cell Size']]
# print 'negative'
# print df_test_negative
df_test_positive=df_test.loc[df_test['Type']==1][['Clump Thickness','Cell Size']]
# print 'positive'
# print df_test_positive
#绘制样本分布
plt.scatter(df_test_negative['Clump Thickness'], df_test_negative['Cell Size'], marker='o', s = 200, c = 'red')
plt.scatter(df_test_positive['Clump Thickness'], df_test_positive['Cell Size'], marker='x', s = 150, c = 'black')
plt.xlabel(u'肿块厚度')
plt.ylabel(u'细胞尺寸')
plt.show()



In [ ]: