Skip to content

Commit e3f1687

Browse files
committed
Write compliant Parquet with pyarrow if supported
1 parent ef97dd4 commit e3f1687

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pandas/io/parquet.py

+7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
FilePathOrBuffer,
1414
StorageOptions,
1515
)
16+
from pandas.compat import pa_version_under4p0
1617
from pandas.compat._optional import import_optional_dependency
1718
from pandas.errors import AbstractMethodError
1819
from pandas.util._decorators import doc
@@ -179,6 +180,12 @@ def write(
179180
mode="wb",
180181
is_dir=partition_cols is not None,
181182
)
183+
184+
# Output compliant Parquet if PyArrow supports it and the user hasn't
185+
# explicitly set the desired behavior
186+
if not pa_version_under4p0 and "use_compliant_nested_type" not in kwargs:
187+
kwargs["use_compliant_nested_type"] = True
188+
182189
try:
183190
if partition_cols is not None:
184191
# writes to multiple files under the given path

0 commit comments

Comments
 (0)