2019-02-15
阅读量:
668
python模型如何导入序列数据
在pandas中,重要的数据类型是:
系列:系列是一维标记数组,能够保存任何数据类型。
它是一个二维标记数据结构,具有可能不同类型的列。您可以将其视为电子表格或SQL表,或Series对象的字典。它通常是最常用的pandas对象。
import pandas as pd
# reading csv file
data = pd.read_csv('weather.csv')
# shape of dataset
print("Shape:", data.shape)
# column names
print("\nFeatures:", data.columns)
# storing the feature matrix (X) and response vector (y)
X = data[data.columns[:-1]]
y = data[data.columns[-1]]
# printing first 5 rows of feature matrix
print("\nFeature matrix:\n", X.head())
# printing first 5 values of response vector
print("\nResponse vector:\n", y.head())






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论