Skip to content

feat: warn the deprecated max_download_size, random_state and sampling_method parameters in (DataFrame|Series).to_pandas() #1573

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

Merged
merged 6 commits into from
Apr 8, 2025

Conversation

chelsea-lin
Copy link
Contributor

@chelsea-lin chelsea-lin commented Mar 31, 2025

Fixes internal issue 391676515 🦕

@chelsea-lin chelsea-lin requested a review from tswast March 31, 2025 17:15
@chelsea-lin chelsea-lin requested review from a team as code owners March 31, 2025 17:15
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Mar 31, 2025
@chelsea-lin chelsea-lin marked this pull request as draft March 31, 2025 17:32
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_randomstate branch from d13bd11 to 74be48d Compare March 31, 2025 18:49
@chelsea-lin chelsea-lin marked this pull request as ready for review March 31, 2025 18:49
@chelsea-lin chelsea-lin changed the title feat!: deprecate random_state and sampling_method in DataFrame.to_pandas feat: warn the deprecated random_state and sampling_method parameters and in (DataFrame|Series).to_pandas() Mar 31, 2025
@chelsea-lin chelsea-lin changed the title feat: warn the deprecated random_state and sampling_method parameters and in (DataFrame|Series).to_pandas() feat: warn the deprecated random_state and sampling_method parameters in (DataFrame|Series).to_pandas() Mar 31, 2025
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_randomstate branch from 74be48d to d41fea1 Compare April 2, 2025 18:17
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Apr 2, 2025
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_randomstate branch from d41fea1 to 18661bb Compare April 2, 2025 23:42
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Apr 2, 2025
@chelsea-lin chelsea-lin closed this Apr 3, 2025
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_randomstate branch from d60123c to 9711b83 Compare April 3, 2025 05:55
@product-auto-label product-auto-label bot added size: u Pull request is empty. and removed size: l Pull request size is large. labels Apr 3, 2025
@chelsea-lin chelsea-lin changed the title feat: warn the deprecated random_state and sampling_method parameters in (DataFrame|Series).to_pandas() feat: warn the deprecated max_download_size, random_state and sampling_method parameters in (DataFrame|Series).to_pandas() Apr 3, 2025
@chelsea-lin chelsea-lin reopened this Apr 3, 2025
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: u Pull request is empty. labels Apr 3, 2025
Copy link
Collaborator

@tswast tswast left a comment

Choose a reason for hiding this comment

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

Looks like theres some typos in the docstrings. Please fix.

@@ -1636,17 +1636,27 @@ def to_pandas(

Args:
max_download_size (int, default None):
.. deprecated:: 2.0.0
`max_download_size` parameter is deprecated. Please use `to_pandas_batch()` method
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: RST uses two backticks for code format. One is italics.

Suggested change
`max_download_size` parameter is deprecated. Please use `to_pandas_batch()` method
``max_download_size`` parameter is deprecated. Please use ``to_pandas_batches()`` method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catches. Fixed!

if max_download_size is not None:
msg = bfe.format_message(
"DEPRECATED: The `max_download_size` parameters for `DataFrame.to_pandas()` "
"are deprecated and will be removed soon. Please use `DataFrame.to_pandas_batch()`."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"are deprecated and will be removed soon. Please use `DataFrame.to_pandas_batch()`."
"are deprecated and will be removed soon. Please use ``DataFrame.to_pandas_batches()``."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catches. Fixed!

@chelsea-lin chelsea-lin force-pushed the main_chelsealin_randomstate branch from f64c060 to ea82a5b Compare April 3, 2025 23:14
@chelsea-lin chelsea-lin requested a review from tswast April 3, 2025 23:34
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_randomstate branch from 38a085b to c1d379d Compare April 4, 2025 05:33
@chelsea-lin chelsea-lin added the kokoro:run Add this label to force Kokoro to re-run the tests. label Apr 4, 2025
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_randomstate branch from c1d379d to 626d432 Compare April 7, 2025 22:57
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Apr 7, 2025
Copy link
Collaborator

@tswast tswast left a comment

Choose a reason for hiding this comment

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

Thanks!

I added a commit to use FutureWarning instead of UserWarning. See: https://docs.python.org/3/library/exceptions.html#FutureWarning

Per https://stackoverflow.com/a/55378483/101923 both DeprecationWarning and PendingDeprecationWarning are ignored by default, so FutureWarning is the most appropriate for bigframes which is used in notebooks and won't necessarily have pytest test code or similar where the deprecation warnings would be seen.

@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Apr 8, 2025
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_randomstate branch from 83fb83f to a22a470 Compare April 8, 2025 17:56
@product-auto-label product-auto-label bot added size: m Pull request size is medium. size: l Pull request size is large. and removed size: l Pull request size is large. size: m Pull request size is medium. labels Apr 8, 2025
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_randomstate branch from 9f72eb5 to a22a470 Compare April 8, 2025 18:08
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: l Pull request size is large. labels Apr 8, 2025
@chelsea-lin chelsea-lin enabled auto-merge (squash) April 8, 2025 18:25
@chelsea-lin chelsea-lin merged commit b9623da into main Apr 8, 2025
18 of 24 checks passed
@chelsea-lin chelsea-lin deleted the main_chelsealin_randomstate branch April 8, 2025 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants