OK wow lot harder to remove value from column than expected

This commit is contained in:
benjamin melançon 2021-12-12 15:44:19 -05:00
parent 99b4d47e3c
commit 8cb00bf086

View file

@ -105,6 +105,9 @@ for days, phrases in timeshift_days.items():
timelog.loc[timelog.tmp_timeshift.str.lower().isin(phrases), "tmp_daysdelta"] = int(days) timelog.loc[timelog.tmp_timeshift.str.lower().isin(phrases), "tmp_daysdelta"] = int(days)
timelog['tmp_daysdelta'] = timelog['tmp_daysdelta'].fillna(0) timelog['tmp_daysdelta'] = timelog['tmp_daysdelta'].fillna(0)
timelog['date'] = timelog['date'] + pd.to_timedelta(timelog['tmp_daysdelta'], unit='D') timelog['date'] = timelog['date'] + pd.to_timedelta(timelog['tmp_daysdelta'], unit='D')
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="")
# If a multiplier has been provided (an asterisk and an integer at the end of a # 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. # task), then multiply the time by it and remove it from the description.