Skip to content

Fix the output of df.describe on an empty categorical / object column #26474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 1, 2019
Merged
Prev Previous commit
Next Next commit
BUG: Ensure that the index values obtained when calling describe on a…
…n empty Categorical / Object column is the same as that of an non empty column
  • Loading branch information
enisnazif committed May 26, 2019
commit 302b28ce2aea4a0735ed9160ace71bb7cbc2729a
2 changes: 2 additions & 0 deletions pandas/tests/frame/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,8 @@ def test_describe_categorical(self):
result = df3.describe()
tm.assert_numpy_array_equal(result["cat"].values, result["s"].values)

def test_describe_empty_categorical_column(self):
# GH 26397
# Ensure the index of an an empty categoric DataFrame column
# also contains (count, unique, top, freq)
df = pd.DataFrame({"empty_col": Categorical([])})
Expand Down