Skip to content

Commit f205094

Browse files
committed
TST: DataFrame.to_parquet accepts pathlib.Path with partition_cols defined
1 parent 15539fa commit f205094

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pandas/tests/io/test_parquet.py

+15
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from distutils.version import LooseVersion
44
from io import BytesIO
55
import os
6+
import pathlib
67
from warnings import catch_warnings
78

89
import numpy as np
@@ -663,6 +664,20 @@ def test_partition_cols_string(self, pa, df_full):
663664
assert len(dataset.partitions.partition_names) == 1
664665
assert dataset.partitions.partition_names == set(partition_cols_list)
665666

667+
def test_partition_cols_pathlib(self, pa, df_compat):
668+
# GH 35902
669+
670+
partition_cols = "B"
671+
partition_cols_list = [partition_cols]
672+
df = df_compat
673+
674+
with tm.ensure_clean_dir() as path_str:
675+
df.to_parquet(path_str, partition_cols=partition_cols_list)
676+
677+
with tm.ensure_clean_dir() as path_str:
678+
path_posix = pathlib.Path(path_str)
679+
df_compat.to_parquet(path_posix, partition_cols=partition_cols_list)
680+
666681
def test_empty_dataframe(self, pa):
667682
# GH #27339
668683
df = pd.DataFrame()

0 commit comments

Comments
 (0)