Skip to content

Commit 6febabf

Browse files
docs: ensure that PlotAccessor is included in the API reference (#17513)
Currently, [this page](https://dataframes.bigquery.dev/reference/api/bigframes.pandas.DataFrame.plot.html#bigframes.pandas.DataFrame.plot) is blank. <img width="1870" height="1412" alt="image" src="https://github.com/user-attachments/assets/bfc93846-7000-4ff6-a336-a36baba324ad" /> After this change: <img width="1870" height="1412" alt="image" src="https://github.com/user-attachments/assets/5c5f8c8e-a966-475e-845d-ec33df41455e" /> 🦕 --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 204667b commit 6febabf

5 files changed

Lines changed: 20 additions & 4 deletions

File tree

packages/bigframes/bigframes/_tools/docs.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@ def decorator(target_class):
3434
except AttributeError:
3535
pass
3636

37+
underlying = None
38+
if isinstance(target_item, property):
39+
underlying = target_item.fget
40+
elif hasattr(target_item, "__func__"):
41+
underlying = target_item.__func__
42+
elif hasattr(target_item, "func"):
43+
underlying = getattr(target_item, "func", None)
44+
45+
if underlying is not None:
46+
try:
47+
underlying.__doc__ = source_item.__doc__
48+
except AttributeError:
49+
pass
50+
3751
return target_class
3852

3953
return decorator

packages/bigframes/bigframes/pandas/api/typing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
from bigframes.core.groupby.series_group_by import SeriesGroupBy
2222
from bigframes.core.window import Window
2323
from bigframes.operations.datetimes import DatetimeMethods
24+
from bigframes.operations.plotting import PlotAccessor
2425
from bigframes.operations.strings import StringMethods
2526
from bigframes.operations.structs import StructAccessor, StructFrameAccessor
2627

2728
__all__ = [
2829
"DataFrameGroupBy",
2930
"DatetimeMethods",
31+
"PlotAccessor",
3032
"SeriesGroupBy",
3133
"StringMethods",
3234
"StructAccessor",

packages/bigframes/docs/templates/toc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
- name: DataFrame
4343
uid: bigframes.dataframe.DataFrame
4444
- name: PlotAccessor
45-
uid: bigframes.operations.plotting.PlotAccessor
45+
uid: bigframes.pandas.api.typing.PlotAccessor
4646
- name: StructAccessor
4747
uid: bigframes.operations.structs.StructFrameAccessor
4848
name: DataFrame
@@ -86,7 +86,7 @@
8686
- name: ListAccessor
8787
uid: bigframes.operations.lists.ListAccessor
8888
- name: PlotAccessor
89-
uid: bigframes.operations.plotting.PlotAccessor
89+
uid: bigframes.pandas.api.typing.PlotAccessor
9090
name: Series
9191
- name: Window
9292
uid: bigframes.core.window.Window

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7335,7 +7335,7 @@ def plot(self):
73357335
Make plots of Dataframes.
73367336
73377337
Returns:
7338-
bigframes.operations.plotting.PlotAccessor:
7338+
bigframes.pandas.api.typing.PlotAccessor:
73397339
An accessor making plots.
73407340
"""
73417341
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5450,7 +5450,7 @@ def plot(self):
54505450
<Axes: title={'center': 'My plot'}, ylabel='Frequency'>
54515451
54525452
Returns:
5453-
bigframes.operations.plotting.PlotAccessor:
5453+
bigframes.pandas.api.typing.PlotAccessor:
54545454
An accessor making plots.
54555455
"""
54565456
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

0 commit comments

Comments
 (0)