Make one CSV logfile vs directory an option determined via settings.ini

Default to directory.
This commit is contained in:
benjamin melançon 2021-05-28 14:21:52 -04:00
parent 8c8c00586d
commit d952f11350

View file

@ -12,20 +12,21 @@ if hasattr(sys, 'ps1'):
else:
debug = False
# This works for one file:
timelog = pd.read_csv(settings.pomodoro_logfile())
if settings.pomodoro_logfile():
# This works for one file:
timelog = pd.read_csv(settings.pomodoro_logfile())
else:
# For multiple files:
path = settings.pomodoro_logpath()
all_files = glob.glob(path + "*.csv")
# For multiple files:
#path = settings.pomodoro_logpath()
#all_files = glob.glob(path + "*.csv")
#
#li = []
#
#for filename in all_files:
# df = pd.read_csv(filename, index_col=None, header=0)
# li.append(df)
li = []
# timelog = pd.concat(li, axis=0, ignore_index=True)
for filename in all_files:
df = pd.read_csv(filename, index_col=None, header=0)
li.append(df)
timelog = pd.concat(li, axis=0, ignore_index=True)
if debug:
imported = copy.deepcopy(timelog)