|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | | -"""BigQuery DataFrames provides a DataFrame API backed by the BigQuery engine.""" |
| 15 | +""" |
| 16 | +The primary entry point for the BigQuery DataFrames (BigFrames) pandas-compatible API. |
| 17 | +
|
| 18 | +**BigQuery DataFrames** provides a Pythonic DataFrame and machine learning (ML) API |
| 19 | +powered by the BigQuery engine. The ``bigframes.pandas`` module implements a large |
| 20 | +subset of the pandas API, allowing you to perform large-scale data analysis |
| 21 | +using familiar pandas syntax while the computations are executed in the cloud. |
| 22 | +
|
| 23 | +**Key Features:** |
| 24 | +
|
| 25 | +* **Petabyte-Scale Scalability:** Handle datasets that exceed local memory by |
| 26 | + offloading computation to the BigQuery distributed engine. |
| 27 | +* **Pandas Compatibility:** Use common pandas methods like |
| 28 | + :func:`~bigframes.pandas.DataFrame.groupby`, |
| 29 | + :func:`~bigframes.pandas.DataFrame.merge`, |
| 30 | + :func:`~bigframes.pandas.DataFrame.pivot_table`, and more on BigQuery-backed |
| 31 | + :class:`~bigframes.pandas.DataFrame` objects. |
| 32 | +* **Direct BigQuery Integration:** Read from and write to BigQuery tables and |
| 33 | + queries with :func:`bigframes.pandas.read_gbq` and |
| 34 | + :func:`bigframes.pandas.to_gbq`. |
| 35 | +* **User-defined Functions (UDFs):** Effortlessly deploy Python functions |
| 36 | + functions using the :func:`bigframes.pandas.remote_function` and |
| 37 | + :func:`bigframes.pandas.udf` decorators. |
| 38 | +* **Data Ingestion:** Support for various formats including CSV, Parquet, JSON, |
| 39 | + and Arrow via :func:`bigrames.pandas.read_csv`, |
| 40 | + :func:`bigframes.pandas.read_parquet`, etc., which are automatically uploaded |
| 41 | + to BigQuery for processing. Convert any pandas DataFrame into a BigQuery |
| 42 | + DataFrame using :func:`bigframes.pandas.read_pandas`. |
| 43 | +
|
| 44 | +**Example usage:** |
| 45 | +
|
| 46 | + >>> import bigframes.pandas as bpd |
| 47 | +
|
| 48 | +Initialize session and set options. |
| 49 | +
|
| 50 | + >>> bpd.options.bigquery.project = "your-project-id" # doctest: +SKIP |
| 51 | +
|
| 52 | +Load data from a BigQuery public dataset. |
| 53 | +
|
| 54 | + >>> df = bpd.read_gbq("bigquery-public-data.usa_names.usa_1910_2013") # doctest: +SKIP |
| 55 | +
|
| 56 | +Perform familiar pandas operations that execute in the cloud. |
| 57 | +
|
| 58 | + >>> top_names = ( |
| 59 | + ... df.groupby("name") |
| 60 | + ... .agg({"number": "sum"}) |
| 61 | + ... .sort_values("number", ascending=False) |
| 62 | + ... .head(10) |
| 63 | + ... ) # doctest: +SKIP |
| 64 | +
|
| 65 | +Bring the final, aggregated results back to local memory if needed. |
| 66 | +
|
| 67 | + >>> local_df = top_names.to_pandas() # doctest: +SKIP |
| 68 | +
|
| 69 | +BigQuery DataFrames is designed for data scientists and analysts who need the |
| 70 | +power of BigQuery with the ease of use of pandas. It eliminates the "data |
| 71 | +movement bottleneck" by keeping your data in BigQuery for processing. |
| 72 | +""" |
16 | 73 |
|
17 | 74 | from __future__ import annotations |
18 | 75 |
|
|
0 commit comments