Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
589 views
Welcome To Ask or Share your Answers For Others

1 Answer

For single column:

contrib_df["AMNT"].describe().apply(lambda x: format(x, 'f'))

For entire DataFrame (as suggested by @databyte )

df.describe().apply(lambda s: s.apply('{0:.5f}'.format))

For whole DataFrame (as suggested by @Jayen):

contrib_df.describe().apply(lambda s: s.apply(lambda x: format(x, 'g')))

As the function describe returns a data frame, what the above function does is, it simply formats each row to the regular format. I wrote this answer because I was having a though, in my mind, that was ** It's pointless to get the count of 95 as 95.00000e+01** Also in our regular format its easier to compare.

Before applying the above function we were getting

count    9.500000e+01
mean     5.621943e+05
std      2.716369e+06
min      4.770000e+02
25%      2.118160e+05
50%      2.599960e+05
75%      3.121170e+05
max      2.670423e+07
Name: salary, dtype: float64

After applying, we get

count          95.000000
mean       562194.294737
std       2716369.154553
min           477.000000
25%        211816.000000
50%        259996.000000
75%        312117.000000
max      26704229.000000
Name: salary, dtype: object

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...