1、sklearn库
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
df = pd.read_table('D:\datingTestSet2.txt',header = None)
data=df.iloc[:,0:3]
target=df.iloc[:,3]
x_train,x_test, y_train, y_test =train_test_spl
1