We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In the 2nd example, the column gender is reverse-lexicographically sorted (male then female).
gender
df = DataFrame( { "gender": ["male", "male", "female", "male", "female", "male"], "education": ["low", "medium", "high", "low", "high", "low"], "country": ["US", "FR", "US", "FR", "FR", "FR"], } ) gb = df.groupby(["country", "gender"], as_index=True, sort=False) result = gb.value_counts(sort=False) print(result) # country gender education # US male low 1 # FR male medium 1 # US female high 1 # FR male low 2 # female high 1 # dtype: int64 gb2 = df.groupby(["country", "gender"], as_index=True, sort=False)["education"] result2 = gb2.value_counts(sort=False) print(result2) # country gender education # US male low 1 # FR male low 2 # medium 1 # US female high 1 # FR female high 1 # Name: education, dtype: int64
The text was updated successfully, but these errors were encountered:
rhshadrach
Successfully merging a pull request may close this issue.
In the 2nd example, the column
gender
is reverse-lexicographically sorted (male then female).The text was updated successfully, but these errors were encountered: