16
16
def run_quickstart (project_id : str ) -> None :
17
17
your_gcp_project_id = project_id
18
18
19
- # [START bigquery_bigframes_quickstart ]
19
+ # [START bigquery_bigframes_quickstart_create_dataframe ]
20
20
import bigframes .pandas as bpd
21
21
22
22
# Set BigQuery DataFrames options
@@ -37,12 +37,16 @@ def run_quickstart(project_id: str) -> None:
37
37
38
38
# Efficiently preview the results using the .peek() method.
39
39
df .peek ()
40
+ # [END bigquery_bigframes_quickstart_create_dataframe]
40
41
42
+ # [START bigquery_bigframes_quickstart_calculate_print]
41
43
# Use the DataFrame just as you would a pandas DataFrame, but calculations
42
44
# happen in the BigQuery query engine instead of the local system.
43
45
average_body_mass = df ["body_mass_g" ].mean ()
44
46
print (f"average_body_mass: { average_body_mass } " )
47
+ # [END bigquery_bigframes_quickstart_calculate_print]
45
48
49
+ # [START bigquery_bigframes_quickstart_eval_metrics]
46
50
# Create the Linear Regression model
47
51
from bigframes .ml .linear_model import LinearRegression
48
52
@@ -70,7 +74,7 @@ def run_quickstart(project_id: str) -> None:
70
74
model = LinearRegression (fit_intercept = False )
71
75
model .fit (X , y )
72
76
model .score (X , y )
73
- # [END bigquery_bigframes_quickstart ]
77
+ # [END bigquery_bigframes_quickstart_eval_metrics ]
74
78
75
79
# close session and reset option so not to affect other tests
76
80
bpd .close_session ()
0 commit comments