add toggl time grouper

This commit is contained in:
Thilo Billerbeck 2023-10-04 01:59:47 +02:00
parent 459adb46f0
commit 221b97343d
4 changed files with 34 additions and 0 deletions

View file

@ -60,6 +60,9 @@ in {
(callPackage ./../pkgs/docker-craft-cms-dev-env.nix { (callPackage ./../pkgs/docker-craft-cms-dev-env.nix {
inherit lib; inherit lib;
}) })
(callPackage ./../pkgs/toggl-time-grouper/package.nix {
inherit lib;
})
(import (fetchTarball (import (fetchTarball
"https://github.com/cachix/devenv/archive/v0.6.2.tar.gz")).default "https://github.com/cachix/devenv/archive/v0.6.2.tar.gz")).default
nixpkgs-fmt nixpkgs-fmt

View file

@ -0,0 +1,7 @@
{ lib, python3Packages }:
with python3Packages;
buildPythonApplication {
name = "toggl-time-grouper";
src = ./.;
propagatedBuildInputs = [ pandas ];
}

View file

@ -0,0 +1,9 @@
#!/usr/bin/env python3
from distutils.core import setup
setup(
name='toggl-time-grouper',
version='0.0.1',
scripts=['toggl-time-grouper'],
)

View file

@ -0,0 +1,15 @@
#!/usr/bin/env python3
import pandas as pd
import sys
from pathlib import Path
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 = df.groupby(['Project','Description','Start date'])['Duration'].sum()
df.to_csv(Path(sys.argv[1]).stem + '-grouped.csv')