[ Web Proxy ]
URL:
Viewing: https://docs.cloud.google.com/data-agent-kit/transform-data [Back]  [Original]

Transform data  |  Google Cloud Data Agent Kit  |  Google Cloud Documentation Skip to main content
Google Cloud Documentation [Google Cloud Documentation]
Send feedback

Transform data Stay organized with collections Save and categorize content based on your preferences.

Preview

This product is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the Service Specific Terms, and the Additional Terms for Generative AI Preview Products. Pre-GA products are available "as is" and might have limited support. For more information, see the launch stage descriptions.

The Google Cloud Data Agent Kit lets you use notebooks for data cleaning, feature engineering, and deep analysis.There are three types of notebooks to choose from.

Before you begin

For BigQuery notebooks, the bigframes library must be installed in the same Python virtual environment in which you execute your notebook. When you create a new notebook, the initialization cell contains the following line, which is commented:

#%pip install --upgrade bigframes
  1. Optional: if you don't have the bigframes library installed in your Python virtual environment, remove the comment.

  2. Optional: if you plan to write SQL code in your notebook, install bigquery-magics:

pip install --upgrade bigquery-magics

Required roles

To get the permissions that you need to execute BigQuery notebooks, ask your administrator to grant you the BigQuery Studio User (roles/bigquery.studioUser) on the project you selected in the extension.

To get the permissions that you need for Managed Service for Apache Spark notebooks, ask your administrator to grant you the following roles on the project:

For more information about granting roles, see Manage access to projects, folders, and organizations. You might also be able to get the required permissions through custom roles or other predefined roles.

Transform your data

For data in a BigLake or BigQuery table, the extension provides notebook templates to get you started.

Navigate to a BigQuery or BigLake table:

  1. Open the command palette by pressing Ctrl/Cmd-Shift-P.
  2. Expand the Catalog explorer and find your BigQuery or BigLake.
  3. Right-click the table ID.
  4. From the floating menu, choose Load in Spark DataFrame or Load in BigQuery DataFrame. A new editor displays information about the table.

    You can also find the table using Universal Search. Click the table ID to open a new editor, click the Data tab, and then choose Load in Spark DataFrame or Load in BigQuery DataFrame.

Initialize a notebook

After you load the table, a new Jupyter notebook opens in an editor tab containing the necessary code to load your table in your chosen dataframe type.

  1. If you don't have the required library installed in your Python virtual environment, uncomment the pip install line.

  2. Click Select Kernel and choose a Python kernel.

    For Managed Spark notebooks with remote kernels you must choose a remote Spark kernel.

  3. Run the cell by clicking Run All or pressing Shift+Enter at the bottom of the cell.

  4. If you are prompted to install missing software, click Install.

The cell creates a dataframe containing the data in the selected table.

Apply data transformations to the DataFrame

Add additional cells to the notebook and write the code to transform your data. For BigQuery DataFrames, you can transform the DataFrame using the pandas-compatible API provided by BigQuery DataFrames.

Alternatively, BigQuery DataFrames provides a magics command that you can use to transform a DataFrame by using SQL in a Jupyter notebook. To transform your data using SQL, complete the following steps:

  1. Create and run a cell to activate the Jupyter magics.

    %load_ext bigframes

  2. Create a SQL cell using the %%bqsql magics.

Save the results

Use one of the many output methods provided by your DataFrames type to save the transformed data to BigQuery or Cloud Storage. For BigQuery DataFrames, output methods include the following:

For small data, you can export to Arrow or Pandas for further local manipulation and visualization.

Clean up

To avoid incurring charges to your Google Cloud account, delete any resources that you created but no longer need.

What's next

Send feedback

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-08-28 UTC.

Need to tell us more? [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-28 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page