You can pass a function to float_format
, so can be anything
In [1]:
df = DataFrame(dict(A = [1.2345,10000.12345,1]))
df
Out[1]:
A
0 1.23450
1 10000.12345
2 1.00000
3 rows × 1 columns
In [4]:
pd.set_option('display.float_format',
lambda x: '{:,.4f}'.format(x) if abs(x) < 10000 else '{:,.0f}'.format(x))
In [5]:
df
Out[5]:
A
0 1.2345
1 10,000
2 1.0000
3 rows × 1 columns