Skip to content

Instantly share code, notes, and snippets.

@Seanny123
Created June 13, 2019 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Seanny123/5ecb65b67f6c30f3b93276388e4d2800 to your computer and use it in GitHub Desktop.
Save Seanny123/5ecb65b67f6c30f3b93276388e4d2800 to your computer and use it in GitHub Desktop.
Get amount of time working for MLH from SaveMyTime tracker.
import pandas as pd
def mili_to_h(mili):
return mili / 60 / 60 / 1000
df = pd.read_csv("SaveMyTime export 12_06_2018 to 13_06_2019.csv")
mlh = df[df["activityName"] == "MLH"]
gitkraken_start = pd.Timestamp("2019-05-01 00:00")
ibm_start = pd.Timestamp("2019-05-20 00:00")
mean_start = pd.Timestamp("2019-05-28 17:00")
mlh = mlh.set_index(pd.DatetimeIndex(mlh["activityStartDate"]))
mili_to_h(mlh.loc[(mlh.index > gitkraken_start) & (mlh.index < ibm_start)]["activityDuration [ms]"].sum())
mili_to_h(mlh.loc[(mlh.index > ibm_start) & (mlh.index < mean_start)]["activityDuration [ms]"].sum())
mili_to_h(mlh.loc[mlh.index > mean_start]["activityDuration [ms]"].sum())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment