Gather all csv files in provided directory

This commit is contained in:
benjamin melançon 2021-05-25 15:57:52 -04:00
parent 868c92e863
commit 1f4ec77467

View file

@ -1,11 +1,27 @@
import pandas as pd
import numpy as np
import glob
import re
import sys
# Import our local settings management.
import settings
timelog = pd.read_csv(settings.pomodoro_logfile())
# This works for one file:
# timelog = pd.read_csv(settings.pomodoro_logfile())
# 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)
timelog = pd.concat(li, axis=0, ignore_index=True)
timelog = timelog.dropduplicates(inplace=True)
# Dump bad data. The real solution here is to get rid of the damned 'Cancel'
# button on the Pomodoro Prompt dialog, but i don't know how to do that, so we