Skip to content
Closed
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
6 changes: 3 additions & 3 deletions pandas/tests/io/formats/test_to_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ def test_to_csv_compression(
to_compression = "infer" if to_infer else compression
read_compression = "infer" if read_infer else compression

path_ext = str(temp_file) + "." + compression_to_extension[compression]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont think this change is necessary. also it doesnt match the PR title description

path_ext = temp_file.with_suffix("." + compression_to_extension[compression])
df.to_csv(path_ext, compression=to_compression)
result = pd.read_csv(path_ext, index_col=0, compression=read_compression)
tm.assert_frame_equal(result, df)
Expand All @@ -556,7 +556,7 @@ def test_to_csv_compression_dict(self, compression_only, temp_file):
"zstd": "zst",
}.get(method, method)

path = str(temp_file) + "." + extension
path = temp_file.with_suffix("." + extension)
df.to_csv(path, compression={"method": method})
read_df = pd.read_csv(path, index_col=0)
tm.assert_frame_equal(read_df, df)
Expand All @@ -576,7 +576,7 @@ def test_to_csv_zip_arguments(self, compression, archive_name, temp_file):
# GH 26023
df = DataFrame({"ABC": [1]})

path = str(temp_file) + ".zip"
path = temp_file.with_suffix(".zip")
df.to_csv(
path, compression={"method": compression, "archive_name": archive_name}
)
Expand Down
Loading