8
8
import numpy as np
9
9
import pytest
10
10
11
- from pandas ._config import using_copy_on_write
12
-
13
11
from pandas .compat import is_platform_windows
14
12
from pandas .compat .pyarrow import (
15
13
pa_version_under11p0 ,
@@ -425,15 +423,10 @@ def test_read_filters(self, engine, tmp_path):
425
423
repeat = 1 ,
426
424
)
427
425
428
- def test_write_index (self , engine , using_copy_on_write , request ):
429
- check_names = engine != "fastparquet"
430
- if using_copy_on_write and engine == "fastparquet" :
431
- request .applymarker (
432
- pytest .mark .xfail (reason = "fastparquet write into index" )
433
- )
434
-
426
+ def test_write_index (self ):
427
+ pytest .importorskip ("pyarrow" )
435
428
df = pd .DataFrame ({"A" : [1 , 2 , 3 ]})
436
- check_round_trip (df , engine )
429
+ check_round_trip (df , "pyarrow" )
437
430
438
431
indexes = [
439
432
[2 , 3 , 4 ],
@@ -446,12 +439,12 @@ def test_write_index(self, engine, using_copy_on_write, request):
446
439
df .index = index
447
440
if isinstance (index , pd .DatetimeIndex ):
448
441
df .index = df .index ._with_freq (None ) # freq doesn't round-trip
449
- check_round_trip (df , engine , check_names = check_names )
442
+ check_round_trip (df , "pyarrow" )
450
443
451
444
# index with meta-data
452
445
df .index = [0 , 1 , 2 ]
453
446
df .index .name = "foo"
454
- check_round_trip (df , engine )
447
+ check_round_trip (df , "pyarrow" )
455
448
456
449
def test_write_multiindex (self , pa ):
457
450
# Not supported in fastparquet as of 0.1.3 or older pyarrow version
@@ -1256,23 +1249,6 @@ def test_error_on_using_partition_cols_and_partition_on(
1256
1249
partition_cols = partition_cols ,
1257
1250
)
1258
1251
1259
- @pytest .mark .skipif (using_copy_on_write (), reason = "fastparquet writes into Index" )
1260
- def test_empty_dataframe (self , fp ):
1261
- # GH #27339
1262
- df = pd .DataFrame ()
1263
- expected = df .copy ()
1264
- check_round_trip (df , fp , expected = expected )
1265
-
1266
- @pytest .mark .skipif (using_copy_on_write (), reason = "fastparquet writes into Index" )
1267
- def test_timezone_aware_index (self , fp , timezone_aware_date_list ):
1268
- idx = 5 * [timezone_aware_date_list ]
1269
-
1270
- df = pd .DataFrame (index = idx , data = {"index_as_col" : idx })
1271
-
1272
- expected = df .copy ()
1273
- expected .index .name = "index"
1274
- check_round_trip (df , fp , expected = expected )
1275
-
1276
1252
def test_close_file_handle_on_read_error (self ):
1277
1253
with tm .ensure_clean ("test.parquet" ) as path :
1278
1254
pathlib .Path (path ).write_bytes (b"breakit" )
@@ -1361,10 +1337,3 @@ def test_invalid_dtype_backend(self, engine):
1361
1337
df .to_parquet (path )
1362
1338
with pytest .raises (ValueError , match = msg ):
1363
1339
read_parquet (path , dtype_backend = "numpy" )
1364
-
1365
- @pytest .mark .skipif (using_copy_on_write (), reason = "fastparquet writes into Index" )
1366
- def test_empty_columns (self , fp ):
1367
- # GH 52034
1368
- df = pd .DataFrame (index = pd .Index (["a" , "b" , "c" ], name = "custom name" ))
1369
- expected = pd .DataFrame (index = pd .Index (["a" , "b" , "c" ], name = "custom name" ))
1370
- check_round_trip (df , fp , expected = expected )
0 commit comments