Skip to content

Commit

Permalink
Pandas compat
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruibin-Liu committed Sep 29, 2023
1 parent 211ec92 commit 2926903
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion moldf/write_jcsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,11 @@ def write_jcsv(
with open(file_name, "w", encoding="utf-8") as out_file:
for key, df in data.items():
out_file.write(f"#{key}\n")
out_file.write(df.to_csv(index=False, line_terminator="\n"))
try:
out_file.write(
df.to_csv(index=False, lineterminator="\n")
) # Pandas >= 1.5
except TypeError:
out_file.write(
df.to_csv(index=False, line_terminator="\n")
) # Pandas < 1.5

0 comments on commit 2926903

Please sign in to comment.