Skip to content

Commit

Permalink
edited csv2nidm to support comma or tab delimited files. See issue: i…
Browse files Browse the repository at this point in the history
  • Loading branch information
dbkeator committed Mar 15, 2021
1 parent 151a4cc commit 3f245e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions nidm/experiment/tools/csv2nidm.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,17 @@ def main(argv):
json_map = redcap_datadictionary_to_json(args.redcap, basename(args.csv_file))
else:
json_map = args.json_map
#open CSV file and load into
df = pd.read_csv(args.csv_file)
# open CSV file and load into
# DBK added to accomodate TSV files with tab separator 3/15/21
if args.csv_file.endswith(".csv"):
df = pd.read_csv(args.csv_file)
elif args.csv_file.endswith(".tsv"):
df = pd.read_csv(args.csv_file,sep='\t')
else:
print("ERROR: input file must have .csv (comma-separated) or .tsv (tab separated) extensions/"
"file types. Please change your input file appropriately and re-run.")
print("no NIDM file created!")
exit(1)
#temp = csv.reader(args.csv_file)
#df = pd.DataFrame(temp)

Expand Down
2 changes: 1 addition & 1 deletion nidm/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z"
_version_major = 3
_version_minor = 7
_version_micro = '3' # use '' for first of series, number for 1 and above
_version_micro = '4' # use '' for first of series, number for 1 and above
_version_extra = ''
# _version_extra = '' # Uncomment this for full releases

Expand Down

0 comments on commit 3f245e3

Please sign in to comment.