i would like to ask about creating x_train, y_train and x_test, y_test on CSV has been split into two between data_train.csv and data_test.csv
Asked
Active
Viewed 1,456 times
-2
-
1if you already have data split into test and train data, you can use your data_train.csv for the training data and data_test.csv for the test data. – topsail Jun 19 '22 at 14:41
-
I agree with what topsail said, but what is your question, exactly? – BrokenBenchmark Jun 19 '22 at 15:09
1 Answers
0
This seems a general question, but I can answer with:
You can use following block to import these csv files in your env.
import pandas as pd # for CSV file I/O operations
train = pd.read_csv('../input/data_train.csv')
test = pd.read_csv('../input/data_test.csv')
I did not see your .csv files but it must be:
# x is features, y is your target column
x_train = train.loc[:,1:]
y_train = train.loc[:,0]
x_test = test.loc[:,1:]
y_test = test.loc[:,0]
So, you can obtain the x and y values, if it is not working please open your .csv and parse the coordinates accordingly :)

mcagriaksoy
- 78
- 7