A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/11981 below:

interation of set_eng_float_format and pivot_tables · Issue #11981 · pandas-dev/pandas · GitHub

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4