bigframes.extensions.pandas.dataframe_accessor.BigQueryDataFrameAccessor#
- class bigframes.extensions.pandas.dataframe_accessor.BigQueryDataFrameAccessor(pandas_obj: DataFrame)[source]#
Pandas DataFrame accessor for BigQuery DataFrames functionality.
This accessor is registered under the
bigquerynamespace on pandas DataFrame objects.- sql_scalar(sql_template: str, *, output_dtype=None, session=None)[source]#
Compute a new pandas Series by applying a SQL scalar function to the DataFrame.
The DataFrame is converted to BigFrames by calling
read_pandas, then the SQL template is applied usingbigframes.bigquery.sql_scalar, and the result is converted back to a pandas Series usingto_pandas.- Parameters:
sql_template (str) – A SQL format string with Python-style {0}, {1}, etc. placeholders for each of the columns in the DataFrame (in the order they appear in
df.columns).output_dtype (a BigQuery DataFrames compatible dtype, optional) – If provided, BigQuery DataFrames uses this to determine the output of the returned Series. This avoids a dry run query.
session (bigframes.session.Session, optional) – The BigFrames session to use. If not provided, the default global session is used.
- Returns:
The result of the SQL scalar function as a pandas Series.
- Return type: