mirror of
https://github.com/thilobillerbeck/dotfiles.git
synced 2024-11-22 07:58:49 +01:00
add toggl time grouper
This commit is contained in:
parent
459adb46f0
commit
221b97343d
4 changed files with 34 additions and 0 deletions
|
@ -60,6 +60,9 @@ in {
|
|||
(callPackage ./../pkgs/docker-craft-cms-dev-env.nix {
|
||||
inherit lib;
|
||||
})
|
||||
(callPackage ./../pkgs/toggl-time-grouper/package.nix {
|
||||
inherit lib;
|
||||
})
|
||||
(import (fetchTarball
|
||||
"https://github.com/cachix/devenv/archive/v0.6.2.tar.gz")).default
|
||||
nixpkgs-fmt
|
||||
|
|
7
pkgs/toggl-time-grouper/package.nix
Normal file
7
pkgs/toggl-time-grouper/package.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ lib, python3Packages }:
|
||||
with python3Packages;
|
||||
buildPythonApplication {
|
||||
name = "toggl-time-grouper";
|
||||
src = ./.;
|
||||
propagatedBuildInputs = [ pandas ];
|
||||
}
|
9
pkgs/toggl-time-grouper/setup.py
Normal file
9
pkgs/toggl-time-grouper/setup.py
Normal 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'],
|
||||
)
|
15
pkgs/toggl-time-grouper/toggl-time-grouper
Normal file
15
pkgs/toggl-time-grouper/toggl-time-grouper
Normal 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')
|
Loading…
Reference in a new issue