Python error

Status
You're currently viewing only sngck's posts. Click here to go back to viewing the entire thread.
Not open for further replies.
import numpy as np
import pandas as pd
from sklearn import tree
from sklearn import preprocessing as pp

#read train dataset from CSV input file
train_dataset = pd.read_csv("./Q2_train.csv")
train_data = train_dataset[["Tear Production Rate","Sex","Age","Spectacle Prescription","Astigmatism"]]
train_label = train_dataset.Recommendation

#data preprocessing of train_data
le = pp.LabelEncoder()
le.fit(train_data["Tear Production Rate"])
train_data["Tear Production Rate"] = le.transform(train_data["Tear Production Rate"])
print(train_data)

The above gave me what I wanted but came with the warning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

But I have no idea how to do this...?! Any advice?
 
Status
You're currently viewing only sngck's posts. Click here to go back to viewing the entire thread.
Not open for further replies.