You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
df.to_clipboard(float_format='%.3f')
->
A B
0 -1.151 -2.175
1 -1.031 -1.957
2 -0.619 -0.835
3 2.562 -0.294
4 2.432 0.033
Now using a callable:
df.to_clipboard(float_format='{:.3f}'.format)
->
A B
0 -1.151 -2.175
1 -1.031 -1.957
2 -0.619 -0.835
3 2.562 -0.294
4 2.432 0.033
but this does not work with to_csv:
In [150]: df.to_csv(float_format='{:.3f}'.format)
---------------------------------------------------------------------------
TypeError: unsupported operand type(s) for %: 'builtin_function_or_method' and 'float'
Furthermore, when using a function as float_format, the result is no longer pastable in excel, even with excel=True (the default).
The text was updated successfully, but these errors were encountered:
jorisvandenbossche
changed the title
to_clipboard issues with float_format
to_clipboard issue with float_format
Feb 9, 2015
Related to #9448, using the following example:
to_clipboard
is said to pass thekwargs
toto_csv
(see docs: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_clipboard.html). However, that seems not be fully true for thefloat_format
kwarg:Now using a callable:
but this does not work with
to_csv
:Furthermore, when using a function as
float_format
, the result is no longer pastable in excel, even withexcel=True
(the default).The text was updated successfully, but these errors were encountered: