mirror of
https://github.com/13hannes11/UU_NCML_Project.git
synced 2024-09-03 20:50:59 +02:00
move convert to csv and let it automatically create out folder
This commit is contained in:
15
convert_to_csv_de.py
Normal file
15
convert_to_csv_de.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import pandas as pd
|
||||
import os
|
||||
|
||||
# Convert data to csv
|
||||
base_dir = "./de/"
|
||||
|
||||
out_dir = "csv"
|
||||
if not os.path.exists(base_dir + out_dir):
|
||||
os.makedirs(base_dir + out_dir)
|
||||
|
||||
for dirname, _, filenames in os.walk(base_dir + 'input'):
|
||||
for filename in filenames:
|
||||
read_file = pd.read_excel (os.path.join(dirname, filename))
|
||||
read_file.to_csv (os.path.join(base_dir + out_dir, filename.split(".", 1)[0] + ".csv"), index = None, header=True)
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import pandas as pd
|
||||
import os
|
||||
|
||||
# Convert data to csv
|
||||
for dirname, _, filenames in os.walk('input'):
|
||||
for filename in filenames:
|
||||
read_file = pd.read_excel (os.path.join(dirname, filename))
|
||||
read_file.to_csv (os.path.join('csv', filename.split(".", 1)[0] + ".csv"), index = None, header=True)
|
||||
|
||||
Reference in New Issue
Block a user