Skip to content

Commit 1a0b744

Browse files
authored
fix: the imported samples error and use peek() (#688)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/python-bigquery-dataframes/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕
1 parent adf9889 commit 1a0b744

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

samples/snippets/imported_onnx_model_test.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_imported_sklearn_onnx_model() -> None:
2020

2121
PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT", "bigframes-dev")
2222

23-
# [START bigquery_dataframes_imported_sklearn_onnx_tutorial_import_tensorflow_models]
23+
# [START bigquery_dataframes_imported_sklearn_onnx_tutorial_import_onnx_models]
2424
import bigframes
2525
from bigframes.ml.imported import ONNXModel
2626

@@ -31,13 +31,13 @@ def test_imported_sklearn_onnx_model() -> None:
3131
imported_onnx_model = ONNXModel(
3232
model_path="gs://cloud-samples-data/bigquery/ml/onnx/pipeline_rf.onnx"
3333
)
34-
# [END bigquery_dataframes_imported_sklearn_onnx_tutorial_import_tensorflow_models]
34+
# [END bigquery_dataframes_imported_sklearn_onnx_tutorial_import_onnx_models]
3535
assert imported_onnx_model is not None
3636

3737
# [START bigquery_dataframes_imported_sklearn_onnx_tutorial_make_predictions]
3838
import bigframes.pandas as bpd
3939

4040
df = bpd.read_gbq("bigquery-public-data.ml_datasets.iris")
4141
predictions = imported_onnx_model.predict(df)
42-
predictions.head(5)
42+
predictions.peek(5)
4343
# [END bigquery_dataframes_imported_sklearn_onnx_tutorial_make_predictions]

samples/snippets/imported_tensorflow_model_test.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def test_imported_tensorflow_model() -> None:
3838
import bigframes.pandas as bpd
3939

4040
df = bpd.read_gbq("bigquery-public-data.hacker_news.full")
41-
predictions = imported_tensorflow_model.predict(df)
41+
df_pred = df.rename(columns={"title": "input"})
42+
predictions = imported_tensorflow_model.predict(df_pred)
4243
predictions.head(5)
4344
# [END bigquery_dataframes_imported_tensorflow_tutorial_make_predictions]

0 commit comments

Comments
 (0)