PROFESSIONAL-MACHINE-LEARNING-ENGINEER practice question 1 of 35
You work for an advertising company and want to understand the effectiveness of your company's latest advertising campaign. You have streamed 500 MB of campaign data into BigQuery. You want to query the table, and then manipulate the results of that query with a pandas dataframe in an Al Platform notebook. What should you do?
Full set: 283 questionsThe most efficient and integrated method to query data from BigQuery and load it into a pandas DataFrame within a Vertex AI (formerly AI Platform) Notebook is to use the built-in %%bigquery cell magic. This command allows you to execute a SQL query directly against BigQuery and store the results in a specified pandas DataFrame variable in a single step. This approach avoids the overhead of exporting data to intermediate files in Cloud Storage or a local disk, streamlining the workflow significantly.
B. Exporting to Google Drive and using its API is an unnecessarily complex, multi-step process not designed for this workflow.
C. Downloading to a local machine and then uploading introduces manual steps and inefficient data transfer through an intermediary machine.
D. This is a viable but less efficient method. It requires three separate commands (bq extract, gsutil cp, pandas.readcsv) and creates unnecessary intermediate files in Cloud Storage and on the notebook's local disk.
1. Google Cloud Documentation for Vertex AI Workbench: The official documentation explicitly describes using the %%bigquery magic command to query data and load it into a pandas DataFrame. It states, "To run a BigQuery query and store the results in a pandas DataFrame, add the --dest argument to the %%bigquery magic."
Source: Google Cloud, Vertex AI Documentation, "Query and explore data in a user-managed notebook".
2. Google Cloud BigQuery Client Libraries for Python: The %%bigquery magic is a convenient wrapper around the BigQuery client library. The library's todataframe() method is the underlying function that converts a BigQuery query result set directly into a pandas DataFrame, demonstrating the intended direct integration.
Source: Google Cloud, Python Client for Google BigQuery Documentation, google.cloud.bigquery.job.QueryJob.todataframe().
Keep practicing
Take the free PROFESSIONAL-MACHINE-LEARNING-ENGINEER practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other PROFESSIONAL-MACHINE-LEARNING-ENGINEER practice questions
- Question 2You developed a custom model by using Vertex Al to forecast the sales of your company s p…
- Question 3You are an ML engineer at a global shoe store. You manage the ML models for the company's…
- Question 5During batch training of a neural network, you notice that there is an oscillation in the…
- Question 6You want to rebuild your ML pipeline for structured data on Google Cloud. You are using P…
- Question 7Your team is building a convolutional neural network (CNN)-based architecture from scratc…
- Question 8You were asked to investigate failures of a production line component based on sensor rea…
