How can one modify the format for the output from a groupby operation in pandas that produces scientific notation for very large numbers. I know how to do string formatting in pythong but I'm at a loss when it comes to applying it here.
Granted, the answer I linked in the comments is not very helpful. You can specify your own string converter like so.
In : pd.set_option('display.float_format', lambda x: '%.3f' % x) In : Series(np.random.randn(3))*1000000000 Out: 0 -757322420.605 1 -1436160588.997 2 -1235116117.064 dtype: float64
I'm not sure if that's the preferred way to do this, but it works.
Converting numbers to strings purely for aesthetic purposes seems like a bad idea, but if you have a good reason, this is one way:
In : Series(np.random.randn(3)).apply(lambda x: '%.3f' % x) Out: 0 0.026 1 -0.482 2 -0.694 dtype: object