[英]Training and Testing Splitting Tagging
Here is my dataset:这是我的数据集:
import pandas as pd
fileName= 'user.csv'
df = pd.read_csv("trainingsample_100k_apps.csv",sep=",",header=0)
pd.set_option('max_columns', None)
df
UserID Total Usage
001 20.3
002 40.5
003 10.1
How can I know which row have been selected as training and testing after I applied this query:应用此查询后,如何知道哪一行已被选为训练和测试:
train, test = train_test_split(df, test_size = 0.20)
I want the output to be like this:我希望 output 是这样的:
UserID Total Usage SplitingCategory
001 20.3 Training
002 40.5 Testing
003 10.1 Training
Ok i got the answer好的,我得到了答案
test
and it will appear my test dataset它会出现我的测试数据集
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.