I have a dataframe of integers. Preview (starts from 3 due to first 3 rows removal):
The original data in the 'pixel1' column is int
, but the NAN
there forced it to float
.
I tried to fix it with:
X_train.fillna(method='ffill', inplace=True)
X_train = X_train.astype(int)
print(X_train.head())
that results in:
- can I get the datatype of the value the
fillna
is using? - is there a better way to do so? (better = to skip the
astype
step, as the data isint
originally - I planted theNAN
in the file and that caused the int to float unwanted data conversion...)
I suggest use
ffill
withbfill
for back filling if possible someNaN
s in first row:If not: