I have the dataframe:
a b c d
0 nan Y nan nan
1 1.27838e+06 N 3 96
2 nan N 2 nan
3 284633 Y nan 44
I try to change the data which is non zero to interger type to avoid exponential data(1.27838e+06):
f=lambda x : int(x)
df['a']=np.where(df['a']==None,np.nan,df['a'].apply(f))
But I get error also event thought I wish to change the dtype of not null value, anyone can point out my error? thanks
NaN
cannot be represented by integer, what are you expecting here? If you want ints then you need to state what value you expect here after conversion – Michelinamicheline