Skip to content

Commit db59d5e

Browse files
authored
Merge pull request #1360 from schu/schu/fix-mimic-iv-sqlite-import-py
mimic-iv/buildmimic/sqlite/import.py: replace `strip()`
2 parents 4f065ca + 52767e1 commit db59d5e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mimic-iv/buildmimic/sqlite/import.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
for f in glob("**/*.csv*", recursive=True):
1818
print("Starting processing {}".format(f))
1919
folder, filename = os.path.split(f)
20-
tablename = filename.strip(".gz").strip(".csv").lower()
20+
tablename = filename.lower()
21+
if tablename.endswith('.gz'):
22+
tablename = tablename[:-3]
23+
if tablename.endswith('.csv'):
24+
tablename = tablename[:-4]
2125
if os.path.getsize(f) < THRESHOLD_SIZE:
2226
df = pd.read_csv(f)
2327
df.to_sql(tablename, CONNECTION_STRING)

0 commit comments

Comments
 (0)