Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pandas/io/parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,12 @@ def write(
mode="wb",
is_dir=partition_cols is not None,
)
if isinstance(path_or_handle, io.BufferedWriter):
path_or_handle = path_or_handle.raw.name
if (
isinstance(path_or_handle, io.BufferedWriter)
and hasattr(path_or_handle, "name")
and isinstance(path_or_handle.name, (str, bytes))
):
path_or_handle = path_or_handle.name

try:
if partition_cols is not None:
Expand Down
8 changes: 8 additions & 0 deletions pandas/tests/io/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from pandas._config import get_option

from pandas.compat import is_platform_windows
from pandas.compat.pyarrow import (
pa_version_under2p0,
pa_version_under5p0,
Expand Down Expand Up @@ -728,6 +729,13 @@ def test_unsupported_float16(self, pa):
df = pd.DataFrame(data=data, columns=["fp16"])
self.check_external_error_on_write(df, pa, pyarrow.ArrowException)

@pytest.mark.xfail(
is_platform_windows(),
reason=(
"PyArrow does not cleanup of partial files dumps when unsupported "
"dtypes are passed to_parquet function in windows"
),
)
@pytest.mark.parametrize("path_type", [str, pathlib.Path])
def test_unsupported_float16_cleanup(self, pa, path_type):
# #44847, #44914
Expand Down