35
35
Tuple ,
36
36
Union ,
37
37
)
38
+ import warnings
38
39
39
40
import bigframes_vendored .constants as constants
40
41
import bigframes_vendored .pandas .core .series as vendored_pandas_series
61
62
import bigframes .core .window_spec as windows
62
63
import bigframes .dataframe
63
64
import bigframes .dtypes
65
+ import bigframes .exceptions as bfe
64
66
import bigframes .formatting_helpers as formatter
65
67
import bigframes .operations as ops
66
68
import bigframes .operations .aggregations as agg_ops
@@ -432,17 +434,27 @@ def to_pandas(
432
434
433
435
Args:
434
436
max_download_size (int, default None):
435
- Download size threshold in MB. If max_download_size is exceeded when downloading data
436
- (e.g., to_pandas()), the data will be downsampled if
437
- bigframes.options.sampling.enable_downsampling is True, otherwise, an error will be
438
- raised. If set to a value other than None, this will supersede the global config.
437
+ .. deprecated:: 2.0.0
438
+ ``max_download_size`` parameter is deprecated. Please use ``to_pandas_batches()``
439
+ method instead.
440
+
441
+ Download size threshold in MB. If ``max_download_size`` is exceeded when downloading data,
442
+ the data will be downsampled if ``bigframes.options.sampling.enable_downsampling`` is
443
+ ``True``, otherwise, an error will be raised. If set to a value other than ``None``,
444
+ this will supersede the global config.
439
445
sampling_method (str, default None):
446
+ .. deprecated:: 2.0.0
447
+ ``sampling_method`` parameter is deprecated. Please use ``sample()`` method instead.
448
+
440
449
Downsampling algorithms to be chosen from, the choices are: "head": This algorithm
441
450
returns a portion of the data from the beginning. It is fast and requires minimal
442
451
computations to perform the downsampling; "uniform": This algorithm returns uniform
443
452
random samples of the data. If set to a value other than None, this will supersede
444
453
the global config.
445
454
random_state (int, default None):
455
+ .. deprecated:: 2.0.0
456
+ ``random_state`` parameter is deprecated. Please use ``sample()`` method instead.
457
+
446
458
The seed for the uniform downsampling algorithm. If provided, the uniform method may
447
459
take longer to execute and require more computation. If set to a value other than
448
460
None, this will supersede the global config.
@@ -461,6 +473,19 @@ def to_pandas(
461
473
is not exceeded; otherwise, a pandas Series with downsampled rows of the DataFrame. If dry_run
462
474
is set to True, a pandas Series containing dry run statistics will be returned.
463
475
"""
476
+ if max_download_size is not None :
477
+ msg = bfe .format_message (
478
+ "DEPRECATED: The `max_download_size` parameters for `Series.to_pandas()` "
479
+ "are deprecated and will be removed soon. Please use `Series.to_pandas_batches()`."
480
+ )
481
+ warnings .warn (msg , category = FutureWarning )
482
+ if sampling_method is not None or random_state is not None :
483
+ msg = bfe .format_message (
484
+ "DEPRECATED: The `sampling_method` and `random_state` parameters for "
485
+ "`Series.to_pandas()` are deprecated and will be removed soon. "
486
+ "Please use `Series.sample().to_pandas()` instead for sampling."
487
+ )
488
+ warnings .warn (msg , category = FutureWarning )
464
489
465
490
if dry_run :
466
491
dry_run_stats , dry_run_job = self ._block ._compute_dry_run (
0 commit comments