-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
BugMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateOutput-Formatting__repr__ of pandas objects, to_string__repr__ of pandas objects, to_string
Milestone
Description
There appears to be an interaction between the option for float display length and pivot_table methods on integers. This issue arose when working on a dataset with both floats and integers - but this arose on operations on integers part of the dataset.
The following example throws an error from the format.py
module.
Swap the comments on the formatting options (undoing the setting for floats) and it runs fine.
In my dataset - there were no missing values following the pivot table operation and the error still occurs. In the sample code below, NaNs may be causing the formatting issue, but that didn't appear to be the case for me.
import pandas as pd
import numpy as np
#pd.set_option('display.float_format', None)
pd.set_eng_float_format(accuracy=1)
df = pd.DataFrame(data = np.random.randint(25, size=(10, 3)), columns = list('abc'))
df.pivot_table(values='a', index='b', columns='c')
cheers
Chris
Metadata
Metadata
Assignees
Labels
BugMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateOutput-Formatting__repr__ of pandas objects, to_string__repr__ of pandas objects, to_string