bigframes.pandas.read_pandas#

bigframes.pandas.read_pandas(pandas_dataframe: DataFrame, *, write_engine: constants.WriteEngineType = 'default') bigframes.dataframe.DataFrame[source]#
bigframes.pandas.read_pandas(pandas_dataframe: Series, *, write_engine: constants.WriteEngineType = 'default') bigframes.series.Series
bigframes.pandas.read_pandas(pandas_dataframe: Index, *, write_engine: constants.WriteEngineType = 'default') bigframes.core.indexes.Index

Loads DataFrame from a pandas DataFrame.

The pandas DataFrame will be persisted as a temporary BigQuery table, which can be automatically recycled after the Session is closed.

Note

Data is inlined in the query SQL if it is small enough (roughly 5MB or less in memory). Larger size data is loaded to a BigQuery table instead.

Examples:

>>> d = {'col1': [1, 2], 'col2': [3, 4]}
>>> pandas_df = pd.DataFrame(data=d)
>>> df = bpd.read_pandas(pandas_df)
>>> df
   col1  col2
0     1     3
1     2     4

[2 rows x 2 columns]
Parameters:
  • pandas_dataframe (pandas.DataFrame, pandas.Series, or pandas.Index) – a pandas DataFrame/Series/Index object to be loaded.

  • write_engine (str) –

    How data should be written to BigQuery (if at all). Supported values:

    • ”default”: (Recommended) Select an appropriate mechanism to write data to BigQuery. Depends on data size and supported data types.

    • ”bigquery_inline”: Inline data in BigQuery SQL. Use this when you know the data is small enough to fit within BigQuery’s 1 MB query text size limit.

    • ”bigquery_load”: Use a BigQuery load job. Use this for larger data sizes.

    • ”bigquery_streaming”: Use the BigQuery streaming JSON API. Use this if your workload is such that you exhaust the BigQuery load job quota and your data cannot be embedded in SQL due to size or data type limitations.

    • ”bigquery_write”: [Preview] Use the BigQuery Storage Write API. This feature is in public preview.

Returns:

An equivalent bigframes.pandas.(DataFrame/Series/Index) object

Raises:

ValueError – When the object is not a Pandas DataFrame.