Skip to content

Commit 94ff174

Browse files
doctests
1 parent 8629db3 commit 94ff174

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

packages/bigframes/third_party/bigframes_vendored/pandas/core/frame.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4470,6 +4470,22 @@ def map(self, func, na_action: Optional[str] = None) -> DataFrame:
44704470
<BLANKLINE>
44714471
[7 rows x 2 columns]
44724472
4473+
With experimental Python Transpiler enabled, you can use some lambda functions without
4474+
deploying them as remote functions.
4475+
4476+
>>> bpd.options.experiments.enable_python_transpiler = True
4477+
>>> df_minutes.map(lambda hours: hours / 60)
4478+
system_minutes user_minutes
4479+
0 0.0 0.0
4480+
1 0.5 0.25
4481+
2 1.0 1.25
4482+
3 <NA> 1.5
4483+
4 1.5 0.1
4484+
5 2.0 <NA>
4485+
6 <NA> <NA>
4486+
<BLANKLINE>
4487+
[7 rows x 2 columns]
4488+
44734489
Args:
44744490
func (function):
44754491
Python function wrapped by ``remote_function`` decorator,
@@ -5053,6 +5069,15 @@ def apply(self, func, *, axis=0, args=(), **kwargs):
50535069
1 3.8
50545070
dtype: Float64
50555071
5072+
With experimental Python Transpiler enabled, you can use some lambda functions without
5073+
deploying them as remote functions:
5074+
5075+
>>> bpd.options.experiments.enable_python_transpiler = True
5076+
>>> df.apply(lambda row: 1 + row.col1 + row.col2/row.col3, axis=1)
5077+
0 2.6
5078+
1 3.8
5079+
dtype: Float64
5080+
50565081
Args:
50575082
func (function):
50585083
Function to apply to each column or row. To apply to each row

packages/bigframes/third_party/bigframes_vendored/pandas/core/series.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5631,6 +5631,17 @@ def map(
56315631
3 rAbbIt
56325632
dtype: string
56335633
5634+
With experimental Python Transpiler enabled, you can use some lambda functions without
5635+
deploying them as remote functions:
5636+
5637+
>>> bpd.options.experiments.enable_python_transpiler = True
5638+
>>> s.map(lambda val: val + "fish")
5639+
0 catfish
5640+
1 dogfish
5641+
2 <NA>
5642+
3 rabbitfish
5643+
dtype: string
5644+
56345645
Args:
56355646
arg (function, Mapping, Series):
56365647
remote function, collections.abc.Mapping subclass or Series

0 commit comments

Comments
 (0)