Skip to content

Commit

Permalink
add pandas version check >= 1.5.2 and mod behavior (#938)
Browse files Browse the repository at this point in the history
* add version check and mod behavior if pandas >= 1.5.2 to prevent error in writing csv

* formatting

* adding P. Molfese

---------

Co-authored-by: Molfese <[email protected]>
  • Loading branch information
pmolfese and Molfese authored Apr 20, 2023
1 parent fb6e255 commit 8285c15
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
"affiliation": "Basque Center on Cognition, Brain and Language",
"orcid": "0000-0002-2553-3327"
},
{
"name": "Molfese, Peter",
"affiliation": "National Institutes of Mental Health, CMN",
"orcid": "0000-0002-3045-9408"
},
{
"name": "Salo, Taylor",
"affiliation": "Florida International University",
Expand Down
9 changes: 8 additions & 1 deletion tedana/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,14 @@ def save_tsv(self, data, name):
data_type = type(data)
if not isinstance(data, pd.DataFrame):
raise TypeError(f"data must be pd.Data, not type {data_type}.")
data.to_csv(name, sep="\t", line_terminator="\n", na_rep="n/a", index=False)
if versiontuple(pd.__version__) >= versiontuple("1.5.2"):
data.to_csv(name, sep="\t", lineterminator="\n", na_rep="n/a", index=False)
else:
data.to_csv(name, sep="\t", line_terminator="\n", na_rep="n/a", index=False)


def versiontuple(v):
return tuple(map(int, (v.split("."))))


def get_fields(name):
Expand Down

0 comments on commit 8285c15

Please sign in to comment.