Skip to content

DOC: pd.get_dummies does not correctly describe return value when "columns" is passed #48466

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

Closed
1 task done
toobaz opened this issue Sep 8, 2022 · 1 comment · Fixed by #48467
Closed
1 task done
Labels
Docs Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@toobaz
Copy link
Member

toobaz commented Sep 8, 2022

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/reference/api/pandas.get_dummies.html

Documentation problem

The get_dummies docs do not mention that

  • the name of the output dummies depends on whether a Series or DataFrame is passed as input
  • non-encoded columns are prepended to the result

Suggested fix for documentation

I am pushing a PR in few minutes

@toobaz toobaz added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 8, 2022
@toobaz
Copy link
Member Author

toobaz commented Sep 8, 2022

An example:

In [1]: import pandas as pd

In [2]: df = pd.DataFrame([list(str(i)) for i in range(800, 803)])

In [3]: pd.get_dummies(df, columns=[1])
Out[3]: 
   0  2  1_0
0  8  0    1
1  8  1    1
2  8  2    1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant