-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: avoid copy argument warning in to_pandas
#16917
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -1743,7 +1743,7 @@ def to_pandas( | |||||||
| ) | ||||||||
| if query_job: | ||||||||
| self._set_internal_query_job(query_job) | ||||||||
| return df.set_axis(self._block.column_labels, axis=1, copy=False) | ||||||||
| return df.set_axis(self._block.column_labels, axis=1) | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||
|
|
||||||||
| def to_pandas_batches( | ||||||||
| self, | ||||||||
|
|
@@ -1869,7 +1869,7 @@ def peek( | |||||||
| raise ValueError( | ||||||||
| "Cannot peek efficiently when data has aggregates, joins or window functions applied. Use force=True to fully compute dataframe." | ||||||||
| ) | ||||||||
| return maybe_result.set_axis(self._block.column_labels, axis=1, copy=False) | ||||||||
| return maybe_result.set_axis(self._block.column_labels, axis=1) | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||
|
|
||||||||
| def nlargest( | ||||||||
| self, | ||||||||
|
|
||||||||
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.
The
copyparameter inset_axisis deprecated in recent Pandas versions. To avoid the warning and prevent an unnecessary full copy of the DataFrame (whichset_axisperforms by default in newer versions), it is recommended to assign directly to the.columnsattribute. This is the official Pandas recommendation for replacingset_axis(..., copy=False)when modifying a fresh object.