1.train_test_split(x,y,test_size,random_state)
模块:sklearn.model_selection
功能:将样本数据分割为训练集和测试集。
参数random_state:
在random_state=42,不变的时候,将得到同样的数据划分;
在random_state等于其他值的时候,将得到另外一份不同的划分;
在random_state=None(默认值)时,随机选择种子,每次数据划分结果都不一样。
2.行列转换
#转换成1行
z.reshape(1,-1)
#转换成2行
z.reshape(2,-1)
#转换成1列
z.reshape(-1,1)
#转换成2列
z.reshape(-1,2)