I have the following code, where sp_col
is a sliced column of my dataframe df_1
:
from sklearn.impute import SimpleImputer
import numpy as np
imputer = SimpleImputer(missing_values=np.NaN,strategy='mean')
sp_col =df_1.iloc[:-1,9:28].values.reshape(-1,1)
# print(sp_col.isnull().sum())
for items,j in sp_col.items():
im2 = sp_col
im2 = imputer.fit(im2)
im3 = imputer.transform(sp_col)
I then get the following error:
AttributeError Traceback (most recent call last)
<ipython-input-207-28b34f875d63> in <module>
8 # print(sp_col.isnull().sum())
9
---> 10 for items,j in sp_col.items():
11 im2 = sp_col
12 im2 = imputer.fit(im2)
AttributeError: 'numpy.ndarray' object has no attribute 'items'