I have the dataframe df.info()
:
M 5899 non-null float64
I need to get rid of the .0
that the column M has.
df['M'].value_counts()
4354.0 4382
454.0 98
234324.0 98
I have tried df['M'].astype('int64')
which gives me the same results as above.
What can I do to get rid of the decimal zero?
Did you assign
df['M'] = df['M'].astype('int64')
before runningdf['M'].value_counts()
?yes, actually the df[‘M’].value_counts() should be the last entry..
why would you want to get rid of the decimal place? Note that you have floating point numbers; so it’s a matter of display
I need the numbers as integers no float
There is no doubting that
df['M'] = df['M'].astype('int64')
will convert the column to int values. Are you sure you assign the converted column back to the column usingdf['M']=
?Show 1 more comment