In [46]: pd.set_option(’max_colwidth’, 6)
In [47]: df
Out[47]:
01230 foo bar bim un...
1 horse cow ba... apple
In [55]: df=pd.DataFrame(np.random.choice([0,1,np.nan],size=(10,10)))
In [56]: df
Out[56]:
012345678900110110NaN1NaN11NaN0011NaN1012NaNNaNNaN110NaN01NaN3011NaN0NaN1NaNNaN040100100NaN0050NaN1NaNNaNNaNNaN01NaN60100NaN1NaNNaN0NaN70NaN11NaN1111NaN800NaN0NaN100NaNNaN9NaNNaN0NaNNaNNaN011NaN
display.chop_threshold sets at what level pandas rounds to zero when it displays a Series of DataFrame.
Note, this does not effect the precision at which the number is stored.
In [67]: df=pd.DataFrame(np.random.randn(6,6))
In [68]: pd.set_option(’chop_threshold’, 0)
In [69]: df
Out[69]:
0123450 -0.1980.966 -1.523 -0.1170.296 -1.04811.6411.9062.7720.089 -1.144 -0.63320.925 -0.006 -0.820 -0.601 -1.0390.8253 -0.824 -0.338 -0.928 -0.8400.249 -0.10940.432 -0.4610.337 -3.208 -1.5360.4105 -0.673 -0.741 -0.111 -2.6730.8640.061In [70]: pd.set_option(’chop_threshold’, .5)
In [71]: df
Out[71]:
01234500.0000.966 -1.5230.0000.000 -1.04811.6411.9062.7720.000 -1.144 -0.63320.9250.000 -0.820 -0.601 -1.0390.8253 -0.8240.000 -0.928 -0.8400.0000.00040.0000.0000.000 -3.208 -1.5360.0005 -0.673 -0.7410.000 -2.6730.8640.000
In [74]: pd.set_option(’colheader_justify’, ’right’)
In [75]: df
Out[75]:
A B C00.9330.3010.2890.2021.3250.2030.5890.7040.5310.105 -1.1990.70In [76]: pd.set_option(’colheader_justify’, ’left’)
In [77]: df
Out[77]:
A B C00.9330.3010.2890.2021.3250.2030.5890.7040.5310.105 -1.1990.70