Issue
I am trying to fill all the null values of a feature in a data frame using the SGDClassifier. But before that I am making a train and test dataset having the index data of all the null and non null values
But I am getting this error -
SyntaxError: can't assign to operator
This is my code -
missing_idx = []
for i in range(data2.shape[0]):
if data2['Rupee/sq.ft'][i] is None:
missing_idx.append(i)
#independent parameters
missing_/sqft_X_train = np.array([ [data2['Bedrooms'][i],data2['Bathrooms'][i],data2['Condtion'][i],data2['Purchase Type'][i],data2['Real Estate Regulation Act'][i] ] for i in range(data2.shape[0]) if i not in missing_idx ])
#dependent parameters
missing_/sqft_y_train = np.array([ [data2['Rupee/sq.ft'][i],data2['Price (Lakhs)'][i],data2['Area'][i] ]for i in range(data2.shape[0]) if i not in missing_idx])
missing_/sqft_X_test = np.array([ [data2['Bedrooms'][i],data2['Bathrooms'][i],data2['Condtion'][i],data2['Purchase Type'][i],data2['Real Estate Regulation Act'][i] ] for i in range(data2.shape[0]) if i in missing_idx ])
Can anyone help me out with this?
Any suggestions?
Is there any other method I can use to fill the null values of a specific featur as they are dependent other features?
Solution
variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
You can replace / with underscore
Answered By - zote
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.