Skip to content
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

[REVIEW] Add no_default and adapt Series.reset_index to differentiate None for name parameter #13152

Conversation

galipremsagar
Copy link
Contributor

Description

In pandas-2.0 the behavior for name parameter has changed to actually name a column 0 if no value is passed to name. But if name=None, the column will be named None too:

In [1]: import pandas as pd

In [2]: s = pd.Series([10, 11, 23], index=[2, 3, 5])

In [3]: s
Out[3]: 
2    10
3    11
5    23
dtype: int64

In [4]: s.reset_index()
Out[4]: 
   index   0
0      2  10
1      3  11
2      5  23

In [5]: s.reset_index(name=None)
Out[5]: 
   index  None
0      2    10
1      3    11
2      5    23

To achieve the same behavior in cudf, we had to introduce no_default value(which is same as pandas's no_default value).

This also fixes 18 pytests:

= 965 failed, 86325 passed, 2044 skipped, 992 xfailed, 165 xpassed in 508.32s (0:08:28) =

On pandas_2.0_feature_branch:

= 983 failed, 86277 passed, 2034 skipped, 992 xfailed, 165 xpassed in 541.87s (0:09:01) =

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@galipremsagar galipremsagar self-assigned this Apr 17, 2023
@galipremsagar galipremsagar requested a review from a team as a code owner April 17, 2023 17:45
@github-actions github-actions bot added the Python Affects Python cuDF API. label Apr 17, 2023
@galipremsagar galipremsagar added bug Something isn't working 3 - Ready for Review Ready for review by team 4 - Needs cuDF (Python) Reviewer breaking Breaking change labels Apr 17, 2023
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's match the pandas API layout.

python/cudf/cudf/__init__.py Outdated Show resolved Hide resolved
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add tests for the cases newly supported by this PR (None names)?

@galipremsagar
Copy link
Contributor Author

Can we add tests for the cases newly supported by this PR (None names)?

We do here: https://github.com/rapidsai/cudf/pull/13152/files#diff-5d087b898461a7b9dbabf8cde1c72a8ded397b75fc9402b7108524f24de67adeR1411

@bdice
Copy link
Contributor

bdice commented Apr 17, 2023

Can we add tests for the cases newly supported by this PR (None names)?

We do here: https://github.com/rapidsai/cudf/pull/13152/files#diff-5d087b898461a7b9dbabf8cde1c72a8ded397b75fc9402b7108524f24de67adeR1411

Sorry, I misread the filename and thought that was an implementation and not a test. My mistake. Approving now!

@galipremsagar galipremsagar added 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 3 - Ready for Review Ready for review by team 4 - Needs cuDF (Python) Reviewer labels Apr 18, 2023
@galipremsagar galipremsagar merged commit 81565cf into rapidsai:pandas_2.0_feature_branch Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge breaking Breaking change bug Something isn't working Python Affects Python cuDF API.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants