Registry / gcp / bigframes

bigframes

JSON →
library2.48.0pypypi✓ verified 23d ago

BigQuery DataFrames (bigframes) provides a scalable Python DataFrame and machine learning (ML) API powered by the BigQuery engine. It offers a pandas-like interface for analyzing and manipulating data directly within BigQuery, enabling efficient processing of terabytes of data and seamless integration with BigQuery ML and Vertex AI. The library is actively maintained, currently at version 2.39.0, with a rapid release cadence introducing new features and improvements.

pip install bigframes
INSTALL
IMPORT
SIG · BIGFRAMES
B
bigframes
gcppythonv2.48.0
Install
30.5s avg
Import
7192ms
Disk
714MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.48.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 30.5s · import 7.192s · 709MB
714MB installed
● package 714MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

bigframes.pandas
import bigframes.pandas as bpd
The primary entry point for the pandas-like API.
bigframes.ml
import bigframes.ml
Used for scikit-learn-like machine learning APIs.
bigframes.bigquery
import bigframes.bigquery
Provides access to BigQuery SQL functions without pandas equivalents.

This quickstart demonstrates how to initialize BigQuery DataFrames with your GCP project ID and load data from a public BigQuery table. It then performs a basic operation (`head()`) to trigger query execution and display results. Ensure you have authenticated to Google Cloud and enabled the BigQuery API for your project.

import bigframes.pandas as bpd import os # Set your GCP Project ID. Ensure the BigQuery API is enabled for this project. # For local development, authenticate using `gcloud auth application-default login`. PROJECT_ID = os.environ.get('GCP_PROJECT_ID', 'your-gcp-project-id') bpd.options.bigquery.project = PROJECT_ID # bpd.options.bigquery.location = "US" # Uncomment and set if your dataset is not in US multi-region # bpd.options.bigquery.ordering_mode = "partial" # Recommended for performance # Load a public BigQuery dataset into a BigQuery DataFrame df = bpd.read_gbq("bigquery-public-data.ml_datasets.penguins") # Perform a simple operation and display the head (triggers computation) print(df.head())
Debug
Known issues
breakingIn BigQuery DataFrames v2.0+, the default for `allow_large_results` changed from `True` to `False` for methods that return results to the client (e.g., `peek()`, `to_pandas()`, `to_pandas_batches()`). This can lead to 'BigQuery has a maximum response size limit' errors for large results.
fix
Set `bpd.options.bigquery.allow_large_results = True` or pass `allow_large_results=True` directly to the method, e.g., `df.to_pandas(allow_large_results=True)`.
affects: >=2.0.0
gotchaBigQuery DataFrames uses lazy evaluation. Operations are generally not executed immediately but are instead translated into BigQuery SQL and run only when results are explicitly requested (e.g., by calling `head()`, `to_pandas()`, `to_arrow()`, `plot()`, or printing the DataFrame/Series).
fix
Understand that BigQuery DataFrames operations build a query plan. Use methods like `head()`, `to_pandas()`, or printing the object to trigger execution and retrieve results.
affects: All
gotchaConverting large BigQuery DataFrames to pandas DataFrames using `to_pandas()` can lead to out-of-memory errors on the client side, as it pulls all data into local memory. This negates the scalability benefits of BigQuery DataFrames.
fix
Avoid converting large DataFrames to pandas locally. Perform aggregations, filtering, and transformations using BigQuery DataFrames APIs first. Only use `to_pandas()` on small, already reduced datasets, or when absolutely necessary.
affects: All
gotchaBigQuery DataFrames stores temporary data (e.g., intermediate results) in BigQuery tables within your specified project. These tables persist for seven days by default in `_anonymous_` datasets, incurring storage costs.
fix
Be aware of potential BigQuery storage costs. For long-running or frequently used temporary results, consider managing them explicitly. You can close sessions using `bpd.close_session()` to potentially clean up temporary resources faster, though tables persist for 7 days.
affects: All
gotchaWhen using `read_gbq()`, if your BigQuery dataset is not located in the default 'US' multi-region, you must explicitly set the location using `bpd.options.bigquery.location` or a `NotFound` exception will occur.
fix
Set `bpd.options.bigquery.location = "YOUR_REGION"` (e.g., "EU", "asia-east1") before calling `read_gbq()` if your data resides outside the 'US' multi-region.
affects: All
Errors
Common errors & fixes
AttributeError: module 'bigframes' has no attribute 'dataframe'
This error typically occurs when the `vertexai` SDK is imported, and there's a version incompatibility or conflict with a recently updated `bigframes` library (especially versions 1.0 and above). The `vertexai` SDK might be expecting an older internal API structure from `bigframes` that has changed.
fix
Downgrade the `bigframes` library to a version prior to 1.0 (e.g., `pip install bigframes<1.0.0`) or update the `google-cloud-vertexai` SDK to its latest version, which should have compatibility fixes for the newer `bigframes` API.
TypeError: boolean value of NA is ambiguous
This error often arises when using `DataFrame.apply(axis=1)` in `bigframes` with conditions involving nullable (NA) values, as `bigframes` has limitations in fully replicating `pandas`' `apply(axis=1)` behavior, especially concerning data types and boolean evaluations with missing data.
fix
Refactor the code to use vectorized `bigframes` DataFrame and Series APIs instead of `apply(axis=1)`. For instance, use direct column operations, `df.assign()`, or built-in string/numeric methods. If `apply(axis=1)` is critical and data types are supported, consider leveraging BigQuery Remote Functions (a preview feature) which enables scalar Python functions to run at BigQuery scale.
OrderRequiredError: Op XXX requires an ordering. OR NullIndexError: DataFrame cannot perform YYY as it has no index. Set an index using set_index.
Many operations in `bigframes`, such as `head()`, `iloc`, or certain transformations like `interpolate()`, require the DataFrame to have a defined ordering or an explicit index. Unlike `pandas`, `bigframes` DataFrames do not always implicitly maintain a total order, especially when operating in 'partial ordering' mode for performance.
fix
Explicitly define an index using `df.set_index('your_column')` or ensure the DataFrame is ordered using `df.sort_values('your_column')` before performing the operation. If partial ordering mode is causing issues, consider if it's necessary or adjust `bpd.options.bigquery.ordering_mode` (though this may have performance implications).
Cannot combine sources from different sessions. OR Missing project ID or location for read_gbq/to_gbq.
`bigframes` operations are tied to a BigQuery session, which is configured with a specific Google Cloud project ID and data location. Errors occur if DataFrames from different sessions are combined, or if I/O operations like `read_gbq()` or `to_gbq()` are attempted without correctly setting the `project_id` and `location` for the session or globally.
fix
Ensure that a consistent session is used across related DataFrame operations. Set the global project ID and location using `bigframes.pandas.options.bigquery.project = 'your-project-id'` and `bigframes.pandas.options.bigquery.location = 'your-location'`. If you need to change these settings, call `bigframes.pandas.close_session()` first to reset the current session. Alternatively, manage sessions explicitly by creating `bigframes.Session` objects with `bigframes.BigQueryOptions(project=..., location=...)`.
AttributeError: module 'numpy' has no attribute 'dtypes'
This error typically indicates a version incompatibility between the `bigframes` library and your installed `numpy` package. `bigframes` might be expecting a specific `numpy` API that is either deprecated/removed in a newer `numpy` version or not yet present in an older `numpy` version.
fix
Upgrade your `numpy` package to the latest version (`pip install --upgrade numpy`) to ensure compatibility with `bigframes`. If the issue persists, consult the `bigframes` documentation or GitHub issues for known compatible `numpy` versions and potentially try a specific `numpy` version that is known to work with your `bigframes` version.
Upgrade
Version history
2.48.0latest on PyPI · released Aug 12, 2026
Audit
Dependencies
google-cloud-bigqueryrequiredImplicitly used for backend BigQuery interactions and often needed for explicit client operations (e.g., dataset creation).
pandasoptionalProvides a pandas-compatible API; often used in conjunction with bigframes for local operations or `to_pandas()` conversions.
Agent activity
57 hits · last 30 days
node
46
OpenAI (training)
1
Resources
bigframes — pip install bigframes · libregistry