-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Add docstrings for MultiIndex.levels and MultiIndex.codes #55435
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
Comments
This is the second time I've brought up pr in an open source project, so I misunderstood what you meant, and I'll finish the issue again. |
It's normal, and the issue was difficult to follow, since it was a discussion, but I think the new issue explains better what needs to be done. If you have any question or you need help we are here to help. Thank you! |
We've got now the docstring for |
take |
Hi mileslow do you still need time for this task, or do you mind if I work on it? |
@Rollingterminator1 go for it. |
Hi, is this issue already taken care of? |
Hi, does this issue still need to be worked on? |
1. Ensure Correct Data Types:Make sure that your categorical columns are indeed of the "category" type. You can convert a column to a categorical type using df['categorical_column'] = df['categorical_column'].astype('category') 2. Check for Null Values:Ensure that there are no null values in the categorical columns, as this can sometimes affect grouping. df['categorical_column'].isnull().sum() If there are null values, you might need to handle them appropriately before performing group operations. 3. Understand Grouping Requirements:Make sure you understand the requirements of your grouping operation. For example, if you are trying to group by intervals, ensure that your categorical column is defined with the appropriate intervals. pd.cut(df['numeric_column'], bins=[0, 10, 20, 30]) 4. Use Groupby Correctly:When using grouped_data = df.groupby('categorical_column')['numeric_column'].sum() Or, for multiple grouping columns: grouped_data = df.groupby(['categorical_column1', 'categorical_column2'])['numeric_column'].sum() 5. Check Pandas Version:Ensure that you are using a recent version of pandas. Bugs are often fixed in newer releases. You can check your pandas version with: import pandas as pd
print(pd.__version__) If you're using an older version, consider upgrading: pip install --upgrade pandas 6. Minimal, Complete, and Verifiable Example:If the issue persists, try to create a minimal, complete, and verifiable example that reproduces the problem. This makes it easier for others to help diagnose and fix the issue. If you can provide more details or a sample of your code and data, I might be able to give more specific advice. Additionally, checking the pandas documentation or community forums can sometimes provide insights into common issues or bug reports. |
class MultiIndex:
|
take |
take |
Hi, I would like to contribute. |
Hi, looks like this has been inactive for a while so I'd like to try it |
take |
Ah it looks like there is already a docstring for pandas/pandas/core/indexes/multi.py Lines 1080 to 1102 in b1525c4
|
take |
Looks like #57601 fixed this - can we close this? |
@datapythonista can we close this? Looks like was solved by #57601 |
is the issue still open ? |
The docstrings have been added, but there are many more issues labeled with 'Docs' that we would appreciate your help on |
xref #55148
Seems like those docstrings are empty, we should create them.
See the attributes section here: https://pandas.pydata.org/docs/reference/api/pandas.MultiIndex.html
The docstring for `MultiIndex.levels should include information to make clear that levels are preserved even if the dataframe using the index doesn't contain all levels. See this page in the docs: https://pandas.pydata.org/docs/user_guide/advanced.html#defined-levels and this comment: #55433 (review)
The text was updated successfully, but these errors were encountered: