Skip to content

Commit 7dc6db7

Browse files
committed
fix more samples
1 parent 90cf6ab commit 7dc6db7

File tree

7 files changed

+31
-29
lines changed

7 files changed

+31
-29
lines changed

bigframes/dataframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4247,7 +4247,7 @@ def _resample(
42474247
42484248
**Examples:**
42494249
4250-
4250+
>>> import bigframes.pandas as bpd
42514251
>>> data = {
42524252
... "timestamp_col": pd.date_range(
42534253
... start="2021-01-01 13:00:00", periods=30, freq="1s"

bigframes/operations/strings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def reverse(self) -> series.Series:
6767
6868
**Examples:**
6969
70-
70+
>>> import bigframes.pandas as bpd
7171
>>> s = bpd.Series(["apple", "banana", "", pd.NA])
7272
>>> s.str.reverse()
7373
0 elppa

bigframes/series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2416,7 +2416,7 @@ def _resample(
24162416
24172417
**Examples:**
24182418
2419-
2419+
>>> import bigframes.pandas as bpd
24202420
>>> data = {
24212421
... "timestamp_col": pd.date_range(
24222422
... start="2021-01-01 13:00:00", periods=30, freq="1s"

bigframes/session/__init__.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,9 @@ def read_gbq_query(
617617
618618
**Examples:**
619619
620-
621620
Simple query input:
622621
622+
>>> import bigframes.pandas as bpd
623623
>>> df = bpd.read_gbq_query('''
624624
... SELECT
625625
... pitcherFirstName,
@@ -771,9 +771,9 @@ def read_gbq_table(
771771
772772
**Examples:**
773773
774-
775774
Read a whole table, with arbitrary ordering or ordering corresponding to the primary key(s).
776775
776+
>>> import bigframes.pandas as bpd
777777
>>> df = bpd.read_gbq_table("bigquery-public-data.ml_datasets.penguins")
778778
779779
See also: :meth:`Session.read_gbq`.
@@ -875,9 +875,9 @@ def read_gbq_model(self, model_name: str):
875875
876876
**Examples:**
877877
878-
879878
Read an existing BigQuery ML model.
880879
880+
>>> import bigframes.pandas as bpd
881881
>>> model_name = "bigframes-dev.bqml_tutorial.penguins_model"
882882
>>> model = bpd.read_gbq_model(model_name)
883883
@@ -1872,7 +1872,7 @@ def udf(
18721872
You can clean-up the BigQuery functions created above using the BigQuery
18731873
client from the BigQuery DataFrames session:
18741874
1875-
>>> session = bpd.get_global_session()
1875+
>>> session = bpd.get_global_session() # doctest: +SKIP
18761876
>>> session.bqclient.delete_routine(minutes_to_hours.bigframes_bigquery_function) # doctest: +SKIP
18771877
>>> session.bqclient.delete_routine(get_hash.bigframes_bigquery_function) # doctest: +SKIP
18781878
@@ -1980,10 +1980,10 @@ def read_gbq_function(
19801980
19811981
**Examples:**
19821982
1983-
19841983
Use the [cw_lower_case_ascii_only](https://github.com/GoogleCloudPlatform/bigquery-utils/blob/master/udfs/community/README.md#cw_lower_case_ascii_onlystr-string)
19851984
function from Community UDFs.
19861985
1986+
>>> import bigframes.pandas as bpd
19871987
>>> func = bpd.read_gbq_function("bqutil.fn.cw_lower_case_ascii_only")
19881988
19891989
You can run it on scalar input. Usually you would do so to verify that
@@ -2043,13 +2043,13 @@ def read_gbq_function(
20432043
Another use case is to define your own remote function and use it later.
20442044
For example, define the remote function:
20452045
2046-
>>> @bpd.remote_function(cloud_function_service_account="default")
2046+
>>> @bpd.remote_function(cloud_function_service_account="default") # doctest: +SKIP
20472047
... def tenfold(num: int) -> float:
20482048
... return num * 10
20492049
20502050
Then, read back the deployed BQ remote function:
20512051
2052-
>>> tenfold_ref = bpd.read_gbq_function(
2052+
>>> tenfold_ref = bpd.read_gbq_function( # doctest: +SKIP
20532053
... tenfold.bigframes_remote_function,
20542054
... )
20552055
@@ -2061,7 +2061,7 @@ def read_gbq_function(
20612061
<BLANKLINE>
20622062
[2 rows x 3 columns]
20632063
2064-
>>> df['a'].apply(tenfold_ref)
2064+
>>> df['a'].apply(tenfold_ref) # doctest: +SKIP
20652065
0 10.0
20662066
1 20.0
20672067
Name: a, dtype: Float64
@@ -2070,11 +2070,11 @@ def read_gbq_function(
20702070
note, row processor implies that the function has only one input
20712071
parameter.
20722072
2073-
>>> @bpd.remote_function(cloud_function_service_account="default")
2073+
>>> @bpd.remote_function(cloud_function_service_account="default") # doctest: +SKIP
20742074
... def row_sum(s: pd.Series) -> float:
20752075
... return s['a'] + s['b'] + s['c']
20762076
2077-
>>> row_sum_ref = bpd.read_gbq_function(
2077+
>>> row_sum_ref = bpd.read_gbq_function( # doctest: +SKIP
20782078
... row_sum.bigframes_remote_function,
20792079
... is_row_processor=True,
20802080
... )
@@ -2087,7 +2087,7 @@ def read_gbq_function(
20872087
<BLANKLINE>
20882088
[2 rows x 3 columns]
20892089
2090-
>>> df.apply(row_sum_ref, axis=1)
2090+
>>> df.apply(row_sum_ref, axis=1) # doctest: +SKIP
20912091
0 9.0
20922092
1 12.0
20932093
dtype: Float64

third_party/bigframes_vendored/pandas/core/config_init.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
2020
Define Repr mode to "deferred" will prevent job execution in repr.
2121
22+
>>> import bigframes.pandas as bpd
2223
>>> df = bpd.read_gbq("bigquery-public-data.ml_datasets.penguins")
2324
2425
>>> bpd.options.display.repr_mode = "deferred"

third_party/bigframes_vendored/pandas/core/series.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -986,9 +986,9 @@ def drop_duplicates(
986986
987987
**Examples:**
988988
989-
990989
Generate a Series with duplicated entries.
991990
991+
>>> import bigframes.pandas as bpd
992992
>>> s = bpd.Series(['llama', 'cow', 'llama', 'beetle', 'llama', 'hippo'],
993993
... name='animal')
994994
>>> s
@@ -1176,7 +1176,7 @@ def round(self, decimals: int = 0) -> Series:
11761176
11771177
**Examples:**
11781178
1179-
1179+
>>> import bigframes.pandas as bpd
11801180
>>> s = bpd.Series([0.1, 1.3, 2.7])
11811181
>>> s.round()
11821182
0 0.0
@@ -1283,17 +1283,17 @@ def autocorr(self, lag: int = 1) -> float:
12831283
12841284
12851285
>>> s = bpd.Series([0.25, 0.5, 0.2, -0.05])
1286-
>>> s.autocorr() # doctest: +ELLIPSIS
1287-
np.float64(0.10355263309024067)
1286+
>>> s.autocorr()
1287+
0.10355263309024065
12881288
12891289
>>> s.autocorr(lag=2)
1290-
np.float64(-1.0)
1290+
-1.0
12911291
12921292
If the Pearson correlation is not well defined, then 'NaN' is returned.
12931293
12941294
>>> s = bpd.Series([1, 0, 0, 0])
12951295
>>> s.autocorr()
1296-
np.float64(nan)
1296+
nan
12971297
12981298
Args:
12991299
lag (int, default 1):
@@ -1927,10 +1927,10 @@ def combine(
19271927
19281928
**Examples:**
19291929
1930-
19311930
Consider 2 Datasets ``s1`` and ``s2`` containing
19321931
highest clocked speeds of different birds.
19331932
1933+
>>> import bigframes.pandas as bpd
19341934
>>> s1 = bpd.Series({'falcon': 330.0, 'eagle': 160.0})
19351935
>>> s1
19361936
falcon 330.0
@@ -2376,7 +2376,7 @@ def replace(
23762376
23772377
**Examples:**
23782378
2379-
2379+
>>> import bigframes.pandas as bpd
23802380
>>> s = bpd.Series([1, 2, 3, 4, 5])
23812381
>>> s
23822382
0 1
@@ -2684,7 +2684,7 @@ def cumprod(self):
26842684
26852685
**Examples:**
26862686
2687-
2687+
>>> import bigframes.pandas as bpd
26882688
>>> s = bpd.Series([2, np.nan, 5, -1, 0])
26892689
>>> s
26902690
0 2.0
@@ -3973,7 +3973,7 @@ def pow(self, other) -> Series:
39733973
39743974
**Examples:**
39753975
3976-
3976+
>>> import bigframes.pandas as bpd
39773977
>>> a = bpd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
39783978
>>> a
39793979
a 1.0
@@ -4006,6 +4006,7 @@ def pow(self, other) -> Series:
40064006
The result of the operation.
40074007
40084008
"""
4009+
# TODO(b/452366836): adjust sample if needed to match pyarrow semantics.
40094010
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
40104011

40114012
def __pow__(self, other):
@@ -4055,7 +4056,7 @@ def rpow(self, other) -> Series:
40554056
40564057
**Examples:**
40574058
4058-
4059+
>>> import bigframes.pandas as bpd
40594060
>>> a = bpd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
40604061
>>> a
40614062
a 1.0
@@ -4610,7 +4611,7 @@ def quantile(
46104611
46114612
**Examples:**
46124613
4613-
4614+
>>> import bigframes.pandas as bpd
46144615
>>> s = bpd.Series([1, 2, 3, 4])
46154616
>>> s.quantile(.5)
46164617
np.float64(2.5)
@@ -5290,7 +5291,7 @@ def str(self):
52905291
52915292
**Examples:**
52925293
5293-
5294+
>>> import bigframes.pandas as bpd
52945295
>>> s = bpd.Series(["A_Str_Series"])
52955296
>>> s
52965297
0 A_Str_Series
@@ -5317,7 +5318,7 @@ def plot(self):
53175318
53185319
**Examples:**
53195320
5320-
5321+
>>> import bigframes.pandas as bpd
53215322
>>> ser = bpd.Series([1, 2, 3, 3])
53225323
>>> plot = ser.plot(kind='hist', title="My plot")
53235324
>>> plot

third_party/bigframes_vendored/pandas/core/tools/timedeltas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ def to_timedelta(
5454
5555
**Examples:**
5656
57-
5857
Converting a Scalar to timedelta
5958
59+
>>> import bigframes.pandas as bpd
6060
>>> scalar = 2
6161
>>> bpd.to_timedelta(scalar, unit='s')
6262
Timedelta('0 days 00:00:02')

0 commit comments

Comments
 (0)