Skip to content

Commit 204842d

Browse files
committed
undo test file deletion
1 parent 187e279 commit 204842d

File tree

3 files changed

+53
-4
lines changed

3 files changed

+53
-4
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
def test_bigquery_dataframes_load_data_from_bigquery() -> None:
17+
# [START bigquery_dataframes_load_data_from_bigquery]
18+
# Create a DataFrame from a BigQuery table:
19+
import bigframes.pandas as bpd
20+
21+
query_or_table = "bigquery-public-data.ml_datasets.penguins"
22+
bq_df = bpd.read_gbq(query_or_table)
23+
# [END bigquery_dataframes_load_data_from_bigquery]
24+
assert bq_df is not None
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
def test_bigquery_dataframes_load_data_from_csv() -> None:
17+
# [START bigquery_dataframes_load_data_from_csv]
18+
import bigframes.pandas as bpd
19+
20+
filepath_or_buffer = "gs://cloud-samples-data/bigquery/us-states/us-states.csv"
21+
df_from_gcs = bpd.read_csv(filepath_or_buffer)
22+
# Display the first few rows of the DataFrame:
23+
df_from_gcs.head()
24+
# [END bigquery_dataframes_load_data_from_csv]
25+
assert df_from_gcs is not None

samples/snippets/sessions_and_io_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,19 @@ def test_sessions_and_io(project_id: str, dataset_id: str) -> None:
130130
# [END bigquery_dataframes_to_pandas_dry_run]
131131
assert df.to_pandas(dry_run=True) is not None
132132

133-
# [START bigquery_dataframes_load_data_from_csv]
133+
# [START bigquery_dataframes_read_data_from_csv]
134134
import bigframes.pandas as bpd
135135

136136
# Read a CSV file from GCS
137137
df = bpd.read_csv("gs://cloud-samples-data/bigquery/us-states/us-states.csv")
138-
# [END bigquery_dataframes_load_data_from_csv]
138+
# [END bigquery_dataframes_read_data_from_csv]
139139
assert df is not None
140140

141-
# [START bigquery_dataframes_load_data_from_bigquery]
141+
# [START bigquery_dataframes_read_data_from_bigquery_table]
142142
import bigframes.pandas as bpd
143143

144144
df = bpd.read_gbq("bigquery-public-data.ml_datasets.penguins")
145-
# [END bigquery_dataframes_load_data_from_bigquery]
145+
# [END bigquery_dataframes_read_data_from_bigquery_table]
146146
assert df is not None
147147

148148
# [START bigquery_dataframes_read_from_sql_query]

0 commit comments

Comments
 (0)