@@ -578,9 +578,12 @@ def test_read_csv_gcs_bq_engine_w_header(session, scalars_df_index, gcs_folder):
578578 path = gcs_folder + "test_read_csv_gcs_bq_engine_w_header*.csv"
579579 scalars_df_index .to_csv (path , index = False )
580580
581- # Skip the header and the first 2 data rows. Without provided schema, the column names
582- # would be like `bool_field_0`, `string_field_1` and etc.
583- df = session .read_csv (path , header = 2 , engine = "bigquery" )
581+ # Skip the header and the first 2 data rows. Note that one line of header
582+ # also got added while writing the csv through `to_csv`, so we would have to
583+ # pass headers=3 in the `read_csv` to skip reading the header and two rows.
584+ # Without provided schema, the column names would be like `bool_field_0`,
585+ # `string_field_1` and etc.
586+ df = session .read_csv (path , header = 3 , engine = "bigquery" )
584587 assert df .shape [0 ] == scalars_df_index .shape [0 ] - 2
585588 assert len (df .columns ) == len (scalars_df_index .columns )
586589
@@ -609,9 +612,12 @@ def test_read_csv_local_bq_engine_w_header(session, scalars_pandas_df_index):
609612 # Using the pandas to_csv method because the BQ one does not support local write.
610613 scalars_pandas_df_index .to_csv (path , index = False )
611614
612- # Skip the header and the first 2 data rows. Without provided schema, the column names
613- # would be like `bool_field_0`, `string_field_1` and etc.
614- df = session .read_csv (path , header = 2 , engine = "bigquery" )
615+ # Skip the header and the first 2 data rows. Note that one line of
616+ # header also got added while writing the csv through `to_csv`, so we
617+ # would have to pass headers=3 in the `read_csv` to skip reading the
618+ # header and two rows. Without provided schema, the column names would
619+ # be like `bool_field_0`, `string_field_1` and etc.
620+ df = session .read_csv (path , header = 3 , engine = "bigquery" )
615621 assert df .shape [0 ] == scalars_pandas_df_index .shape [0 ] - 2
616622 assert len (df .columns ) == len (scalars_pandas_df_index .columns )
617623
0 commit comments