Open bluenote10 opened 1 year ago
Apparently integer DataFrame columns are implicitly converted to floats, which makes proper integer formatting impossible, and worse, passing e.g. `floatfmt=".6f" will lead to non-sense formatting of integer columns. Here is a minimal example:
DataFrame
import pandas as pd import tabulate df = pd.DataFrame({"int_col": [123456789], "float_col": 1.23456789}) print(tabulate.tabulate(df, headers="keys", intfmt=","))
Current output:
int_col float_col -- ----------- ----------- 0 1.23457e+08 1.23457
Expected output:
int_col float_col -- ------------ ----------- 0 12,345,789 1.23457
Tabulate version: 0.9.0
FYI as a work-around one can use df.to_dict("records").
df.to_dict("records")
I have the same issue for large integers with tabulate version 0.9.0
Apparently integer
DataFrame
columns are implicitly converted to floats, which makes proper integer formatting impossible, and worse, passing e.g. `floatfmt=".6f" will lead to non-sense formatting of integer columns. Here is a minimal example:Current output:
Expected output:
Tabulate version: 0.9.0