I have X_train that shapes (14599, 13), i'm trying to impute NaN with column's median but somehow it imputes with row resulting error because in a row there are date, and other than integer values. I already lookup if SimpleImputer has axis parameter but could not find that it exists. How to solve this?
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
from sklearn.impute import SimpleImputer
from sklearn.model_selection import train_test_split
plt.close('all')
avo_sales = pd.read_csv('avocados.csv')
avo_sales.rename(columns = {'4046':'small PLU sold',
'4225':'large PLU sold',
'4770':'xlarge PLU sold'},
inplace= True)
avo_sales.columns = avo_sales.columns.str.replace(' ','')
plt.scatter(avo_sales.Date,avo_sales.TotalBags)
x = np.array(avo_sales.drop(['TotalBags'],1))
y = np.array(avo_sales.TotalBags)
X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.2)
imp = SimpleImputer(strategy='median')
X_train = imp.fit_transform(X_train)
the output
ValueError: Cannot use median strategy with non-numeric data:
could not convert string to float: '12/31/2017'
```