Python:numpy ndarray类型数据集,使用array切片划分为特征和标签

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os

# data = np.array(pd.read_csv(r'E:\dataset\clusterData\aggregation.csv',header=None))
# X = data[:,:2]
# y = data[:,2]
# plt.scatter(X[:,0],X[:,1],c=y)
# plt.show()
# path =

data = np.array(pd.read_csv(r'E:\dataset\clusterData\spiral.csv',header=None))
X = data[:,:-1]
y = data[:,-1]
plt.scatter(X[:,0],X[:,1],c=y)
plt.show()

 

你可能感兴趣的:(Python学习)