设置小数位数
series
与dataframe
都是一样的,在后面直接.round(num)
就可以了
import pandas as pd
series = pd.Series([123, 12343.3242])
print(series.describe().round(2))
打印内容如下:
count 2.00
mean 6233.16
std 8641.07
min 123.00
25% 3178.08
50% 6233.16
75% 9288.24
max 12343.32
dtype: float64
参考文章
pandas官网DOC:https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.round.html