Skip to content

Commit

Permalink
docs: update bigframes.pandas.pandas docstrings (#1247)
Browse files Browse the repository at this point in the history
* docs: update bigframes.pandas.pandas docstrings

* update read_qbq_model return type

* update read_qbq_model return section and callable return type
  • Loading branch information
arwas11 authored Jan 7, 2025
1 parent b863358 commit c4bffc3
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 20 deletions.
3 changes: 2 additions & 1 deletion bigframes/pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ def get_default_session_id() -> str:
the table id of all temporary tables created in the global session.
Returns:
str, the default global session id, ex. 'sessiona1b2c'
str:
The default global session id, ex. 'sessiona1b2c'
"""
return get_global_session().session_id

Expand Down
22 changes: 12 additions & 10 deletions bigframes/session/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1370,13 +1370,14 @@ def remote_function(
`all`, `internal-only`, `internal-and-gclb`. See for more details
https://cloud.google.com/functions/docs/networking/network-settings#ingress_settings.
Returns:
callable: A remote function object pointing to the cloud assets created
in the background to support the remote execution. The cloud assets can be
located through the following properties set in the object:
collections.abc.Callable:
A remote function object pointing to the cloud assets created
in the background to support the remote execution. The cloud assets can be
located through the following properties set in the object:
`bigframes_cloud_function` - The google cloud function deployed for the user defined code.
`bigframes_cloud_function` - The google cloud function deployed for the user defined code.
`bigframes_remote_function` - The bigquery remote function capable of calling into `bigframes_cloud_function`.
`bigframes_remote_function` - The bigquery remote function capable of calling into `bigframes_cloud_function`.
"""
return self._remote_function_session.remote_function(
input_types,
Expand Down Expand Up @@ -1545,12 +1546,13 @@ def read_gbq_function(
a pandas Series.
Returns:
callable: A function object pointing to the BigQuery function read
from BigQuery.
collections.abc.Callable:
A function object pointing to the BigQuery function read
from BigQuery.
The object is similar to the one created by the `remote_function`
decorator, including the `bigframes_remote_function` property, but
not including the `bigframes_cloud_function` property.
The object is similar to the one created by the `remote_function`
decorator, including the `bigframes_remote_function` property, but
not including the `bigframes_cloud_function` property.
"""

return bigframes_rf.read_gbq_function(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ def get_dummies(
Data type for new columns. Only a single dtype is allowed.
Returns:
DataFrame: Dummy-coded data. If data contains other columns than the
dummy-coded one(s), these will be prepended, unaltered, to the
result.
bigframes.pandas.DataFrame:
Dummy-coded data. If data contains other columns than the
dummy-coded one(s), these will be prepended, unaltered, to the
result.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
3 changes: 2 additions & 1 deletion third_party/bigframes_vendored/pandas/core/reshape/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def merge(
no suffix. At least one of the values must not be None.
Returns:
bigframes.dataframe.DataFrame: A DataFrame of the two merged objects.
bigframes.pandas.DataFrame:
A DataFrame of the two merged objects.
"""
raise NotImplementedError("abstract method")
7 changes: 5 additions & 2 deletions third_party/bigframes_vendored/pandas/core/reshape/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def cut(
>>> import bigframes.pandas as bpd
>>> bpd.options.display.progress_bar = None
>>> s = bpd.Series([0, 1, 5, 10])
>>> s
0 0
Expand Down Expand Up @@ -108,7 +109,8 @@ def cut(
bins. This affects the type of the output container.
Returns:
Series: A Series representing the respective bin for each value
bigframes.pandas.Series:
A Series representing the respective bin for each value
of `x`. The type depends on the value of `labels`.
sequence of scalars : returns a Series for Series `x` or a
Categorical for all other inputs. The values stored within
Expand Down Expand Up @@ -140,7 +142,8 @@ def qcut(x, q, *, labels=None, duplicates="error"):
If bin edges are not unique, raise ValueError or drop non-uniques.
Returns:
Series: Categorical or Series of integers if labels is False
bigframes.pandas.Series:
Categorical or Series of integers if labels is False
The return type (Categorical or Series) depends on the input: a Series
of type category if input is a Series else Categorical. Bins are
represented as categories when categorical data is returned.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def to_datetime(
float number.
Returns:
Timestamp, datetime.datetime or bigframes.series.Series: Return type depends on input.
Union[pandas.Timestamp, datetime.datetime or bigframes.pandas.Series]:
Return type depends on input.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
3 changes: 2 additions & 1 deletion third_party/bigframes_vendored/pandas/io/gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def read_gbq(
from a table.
Returns:
bigframes.pandas.DataFrame: A DataFrame representing results of the query or table.
bigframes.pandas.DataFrame:
A DataFrame representing results of the query or table.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
3 changes: 2 additions & 1 deletion third_party/bigframes_vendored/pandas/io/parsers/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ def read_csv(
keyword arguments for `pandas.read_csv` when not using the BigQuery engine.
Returns:
bigframes.pandas.DataFrame: A BigQuery DataFrames.
bigframes.pandas.DataFrame:
A BigQuery DataFrames.
Raises:
bigframes.exceptions.DefaultIndexWarning:
Expand Down

0 comments on commit c4bffc3

Please sign in to comment.