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 20, 2019
commit 1c7b6d1b830819c0c3cdba98f284ce79376b6e99
2 changes: 1 addition & 1 deletion pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ def value_counts(self, dropna=True):

if dropna or clean:
obs = code if clean else code[mask]
count = bincount(obs, minlength=ncat or None)
count = bincount(obs, minlength=ncat or 0)
else:
count = bincount(np.where(mask, code, ncat))
ix = np.append(ix, -1)
Expand Down