updated flake and desktop files

This commit is contained in:
Thilo Billerbeck 2023-11-03 22:26:59 +01:00
parent a13a49d55d
commit 2be0fe9b6f
3 changed files with 18 additions and 8 deletions
home-manager/pkgs/toggl-time-grouper

View file

@ -9,7 +9,16 @@ df = pd.read_csv(sys.argv[1])
df = df.drop(columns=['User', 'Email', 'Billable', 'Tags', 'Amount ()', 'Start time', 'End date', 'End time'])
df['Duration'] = pd.to_timedelta(df['Duration'])
df['Start date'] = pd.to_datetime(df['Start date'])
df['duration_dec'] = df['Duration'].dt.total_seconds() / 3600
df.rename(columns={
'Project': 'project',
'Description': 'description',
'Start date': 'day',
'Duration': 'duration'
}, inplace=True)
df = df.groupby(['Project','Description','Start date'])['Duration'].sum()
df = df.groupby(['project','description','day'], as_index=False).agg({'duration': 'sum'})
df['duration'] = round(df['duration'].dt.total_seconds() / 60 / 60, 2)
print("Total hours are: ", round(df['duration'].sum(), 2))
df.to_csv(Path(sys.argv[1]).stem + '-grouped.csv')
df.to_csv(Path(sys.argv[1]).stem + '-grouped.csv', index=False)