I have a .csv
file that contains my data. I would like to do Logistic Regression
, Naive Bayes
and Decision Trees
. I already know how to implement these.
However, my teacher wants me to split the data in my .csv
file into 80%
and let my algorithms predict the other 20%
. I would like to know how to actually split the data in that way.
diabetes_df = pd.read_csv("diabetes.csv")
diabetes_df.head()
with open("diabetes.csv", "rb") as f:
data = f.read().split()
train_data = data[:80]
test_data = data[20:]
I tried to split it like this (sure it isn't working).