Gather all csv files in provided directory
This commit is contained in:
parent
868c92e863
commit
1f4ec77467
1 changed files with 17 additions and 1 deletions
|
@ -1,11 +1,27 @@
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import glob
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
# Import our local settings management.
|
# Import our local settings management.
|
||||||
import settings
|
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'
|
# 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
|
# button on the Pomodoro Prompt dialog, but i don't know how to do that, so we
|
||||||
|
|
Loading…
Reference in a new issue