无法分配给操作员 - Python



我正在尝试使用SGD分类器填充数据帧中特征的所有空值。但在此之前,我正在制作一个训练和测试数据集,其中包含所有空值和非空值的索引数据

但我得到了这个错误-

SyntaxError: can't assign to operator

这是我的代码-

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 ])

有人能帮我吗
有什么建议吗?

有没有其他方法可以用来填充特定特征的空值,因为它们依赖于其他特征?

变量名只能包含字母数字字符和下划线(A-z、0-9和_(

您可以用下划线替换/

最新更新