Skip to content
44 changes: 35 additions & 9 deletions bigframes/pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@

import bigframes._config as config
from bigframes.core import log_adapter
import bigframes.core.blocks
import bigframes.core.global_session as global_session
import bigframes.core.indexes
from bigframes.core.reshape.api import concat, crosstab, cut, get_dummies, merge, qcut
import bigframes.core.tools
import bigframes.dataframe
import bigframes.enums
import bigframes.functions._utils as bff_utils
from bigframes.pandas import api
from bigframes.pandas.core.api import to_timedelta
from bigframes.pandas.io.api import (
_read_gbq_colab,
Expand All @@ -56,7 +54,6 @@
import bigframes.series
import bigframes.session
import bigframes.session._io.bigquery
import bigframes.session.clients
import bigframes.version

try:
Expand Down Expand Up @@ -410,8 +407,40 @@ def reset_session():
from_glob_path,
]

_function_names = [_function.__name__ for _function in _functions]
_other_names = [
# Use __all__ to let type checkers know what is part of the public API.
# Note that static analysis checkers like pylance depend on these being string
# literals, not derived at runtime.
__all__ = [
# Function names
"clean_up_by_session_id",
"concat",
"crosstab",
"cut",
"deploy_remote_function",
"deploy_udf",
"get_default_session_id",
"get_dummies",
"merge",
"qcut",
"read_csv",
"read_arrow",
"read_gbq",
"_read_gbq_colab",
"read_gbq_function",
"read_gbq_model",
"read_gbq_object_table",
"read_gbq_query",
"read_gbq_table",
"read_json",
"read_pandas",
"read_parquet",
"read_pickle",
"remote_function",
"to_datetime",
"to_timedelta",
"from_glob_path",
# Other names
"api",
# pandas dtype attributes
"NA",
"BooleanDtype",
Expand All @@ -437,9 +466,6 @@ def reset_session():
"udf",
]

# Use __all__ to let type checkers know what is part of the public API.
__all__ = _function_names + _other_names

_module = sys.modules[__name__]

for _function in _functions:
Expand Down
21 changes: 21 additions & 0 deletions bigframes/pandas/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""BigQuery DataFrames public pandas APIs."""

from bigframes.pandas.api import typing

__all__ = [
"typing",
]
35 changes: 35 additions & 0 deletions bigframes/pandas/api/typing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""BigQuery DataFrames public pandas types that aren't exposed in bigframes.pandas.

Note: These objects aren't intended to be constructed directly.
"""

from bigframes.core.groupby.dataframe_group_by import DataFrameGroupBy
from bigframes.core.groupby.series_group_by import SeriesGroupBy
from bigframes.core.window import Window
from bigframes.operations.datetimes import DatetimeMethods
from bigframes.operations.strings import StringMethods
from bigframes.operations.structs import StructAccessor, StructFrameAccessor

__all__ = [
"DataFrameGroupBy",
"DatetimeMethods",
"SeriesGroupBy",
"StringMethods",
"StructAccessor",
"StructFrameAccessor",
"Window",
]
1 change: 1 addition & 0 deletions docs/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ packages.
bigframes.exceptions
bigframes.geopandas
bigframes.pandas
bigframes.pandas.api.typing
bigframes.streaming

ML APIs
Expand Down
54 changes: 22 additions & 32 deletions scripts/publish_api_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,34 +35,16 @@

REPO_ROOT = pathlib.Path(__file__).parent.parent

URL_PREFIX = {
"pandas": (
"https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.pandas#bigframes_pandas_"
),
"dataframe": (
"https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.dataframe.DataFrame#bigframes_dataframe_DataFrame_"
),
"dataframegroupby": (
"https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.core.groupby.DataFrameGroupBy#bigframes_core_groupby_DataFrameGroupBy_"
),
"index": (
"https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.core.indexes.base.Index#bigframes_core_indexes_base_Index_"
),
"series": (
"https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.series.Series#bigframes_series_Series_"
),
"seriesgroupby": (
"https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.core.groupby.SeriesGroupBy#bigframes_core_groupby_SeriesGroupBy_"
),
"datetimemethods": (
"https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.operations.datetimes.DatetimeMethods#bigframes_operations_datetimes_DatetimeMethods_"
),
"stringmethods": (
"https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.operations.strings.StringMethods#bigframes_operations_strings_StringMethods_"
),
"window": (
"https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.core.window.Window#bigframes_core_window_Window_"
),
BIGFRAMES_OBJECT = {
"pandas": "bigframes.pandas",
"dataframe": "bigframes.pandas.DataFrame",
"dataframegroupby": "bigframes.pandas.api.typing.DataFrameGroupBy",
"index": "bigframes.pandas.Index",
"series": "bigframes.pandas.Series",
"seriesgroupby": "bigframes.pandas.api.typing.SeriesGroupBy",
"datetimemethods": "bigframes.pandas.api.typing.DatetimeMethods",
"stringmethods": "bigframes.pandas.api.typing.StringMethods",
"window": "bigframes.pandas.api.typing.Window",
}


Expand Down Expand Up @@ -140,7 +122,7 @@ def generate_pandas_api_coverage():
missing_parameters = ""

# skip private functions and properties
if member[0] == "_" and member[1] != "_":
if member[0] == "_":
continue

# skip members that are also common python methods
Expand Down Expand Up @@ -308,11 +290,19 @@ def build_api_coverage_table(bigframes_version: str, release_version: str):
def format_api(api_names, is_in_bigframes, api_prefix):
api_names = api_names.str.slice(start=len(f"{api_prefix}."))
formatted = "<code>" + api_names + "</code>"
url_prefix = URL_PREFIX.get(api_prefix)
if url_prefix is None:
bigframes_object = BIGFRAMES_OBJECT.get(api_prefix)
if bigframes_object is None:
return formatted

linked = '<a href="' + url_prefix + api_names + '">' + formatted + "</a>"
linked = (
'<a href="https://dataframes.bigquery.dev/reference/api/'
+ bigframes_object
+ "."
+ api_names
+ '.html">'
+ formatted
+ "</a>"
)
return formatted.mask(is_in_bigframes, linked)


Expand Down