.xlsx文件读取:
import pandas as pd
import numpy as np
path = 'C:/Users/12506/Desktop/Molecular_Descriptor.xlsx'
df=pd.read_excel(path)
df_1 = np.array(df)#DataFrame 转 Numpy
结果: df:
df_1:
.npy文件:
path = 'C:/Users/12506/Downloads/MLKNN-master/MLKNN-master/dataset/train_x.npy'
train_x = np.load(path, allow_pickle=True)#这里的allow_pickle要指定为True,否则会报错
.arff文件读取:
import pandas as pd
from scipy.io import arff
data,meta = arff.loadarff('emotions.arff')
df = pd.DataFrame(data)
.data 文件:
import pandas as pd
df = pd.read_csv('hayes-roth.data',header=None)