Decimal class rounding in Pandas

前端 未结 3 1009
小鲜肉
小鲜肉 2021-01-23 16:04

i have problems rounding Decimals() inside a Pandas Dataframe. The round() method does not work and using quantize() neither. I\'ve search

3条回答
  •  鱼传尺愫
    2021-01-23 16:28

    To round your decimal to 2 significant figures for example:

    round(df['yourSeries'].astype('float'), 2)

    Or if you just want an int:

    round(df['yourSeries'].astype('float'))

提交回复
热议问题