-
Notifications
You must be signed in to change notification settings - Fork 915
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
REF: Remove **kwargs from to_pandas, raise if nullable is not implemented #14438
Conversation
python/cudf/cudf/core/_base_index.py
Outdated
@@ -850,7 +850,7 @@ def notna(self): | |||
""" | |||
raise NotImplementedError | |||
|
|||
def to_pandas(self, nullable=False): | |||
def to_pandas(self, nullable: bool = False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: I think we should make all of these arguments keyword-only
def to_pandas(self, *, nullable: bool = False):
...
Rationale: API safety in the case when one can pass more than just nullable
as an argument. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Does that mean I should label this PR as breaking
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably an API break, yes.
if isinstance(cudf_val, cudf.DataFrame): | ||
pd_data = { | ||
col: maybe_return_nullable_pd_obj(series) | ||
for col, series in cudf_val.items() | ||
} | ||
pd_value = pd.DataFrame(pd_data) | ||
else: | ||
pd_value = maybe_return_nullable_pd_obj(cudf_val) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just handling that nullable=True
was previously silently ignored for to_pandas
calls that didn't support it, and now it is loud?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct!
One test |
/merge |
Description
Checklist