只需使用
numpy.round,例如:
100 * np.round(newdf3.pivot_table(rows=['Quradate'], aggfunc=np.mean), 2)
只要round适用于所有列类型,它就适用于
Dataframe。
有一些数据:
In [9]: dfrmOut[9]: A B C0 -1.312700 0.760710 1.0440061 -0.792521 -0.076913 0.0873342 -0.557738 0.982031 1.3653573 1.013947 0.345896 -0.3566524 1.278278 -0.195477 0.5504925 0.116599 -0.670163 -1.2902456 -1.808143 -0.818014 0.7136147 0.233726 0.634349 0.5611038 2.344671 -2.331232 -0.7592969 -1.658047 1.756503 -0.996620In [10]: 100*np.round(dfrm, 2)Out[10]: A B C0 -131 76 1041 -79 -8 92 -56 98 1373 101 35 -364 128 -20 555 12 -67 -1296 -181 -82 717 23 63 568 234 -233 -769 -166 176 -100



