From 8ffc95fe74731acccff16bc0f8423994a438a633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Melan=C3=A7on?= Date: Fri, 17 Dec 2021 23:22:00 -0500 Subject: [PATCH] Remove shifted time from description, final working version --- pomodoro_to_harvest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pomodoro_to_harvest.py b/pomodoro_to_harvest.py index 3b753c9..7c358d0 100644 --- a/pomodoro_to_harvest.py +++ b/pomodoro_to_harvest.py @@ -108,7 +108,8 @@ timelog['date'] = timelog['date'] + pd.to_timedelta(timelog['tmp_daysdelta'], un timelog.tmp_timeshift = '(' + timelog.tmp_timeshift + ')' # timelog['description'] = (np.where(timelog['tmp_daysdelta'] > 0.0, timelog['description'].str.replace(timelog['tmp_timeshift'], ""), timelog['description'])) # timelog.description.replace(regex=r'(?i)' + timelog.tmp_timeshift, value="") -timelog['description'] = timelog.apply(lambda x: x['description'].replace(x['tmp_timeshift']), axis=1) +timelog['tmp_timeshift'] = timelog['tmp_timeshift'].fillna("") +timelog['description'] = timelog.apply(lambda x: x['description'].replace(x['tmp_timeshift'], ''), axis=1) # If a multiplier has been provided (an asterisk and an integer at the end of a # task), then multiply the time by it and remove it from the description.