Fix approach to dropping column after using it

This commit is contained in:
benjamin melançon 2021-04-27 23:51:26 -04:00
parent 3dd830bbb3
commit 28550ef3ff

View file

@ -43,7 +43,7 @@ timelog['description'] = timelog['description'].str.strip()
timelog['tmp_multiplier'] = (np.where(timelog['description'].str.contains('\*\s*\d$'), timelog['description'].str.rsplit('*', 1).str[1].str.strip(), 1)) timelog['tmp_multiplier'] = (np.where(timelog['description'].str.contains('\*\s*\d$'), timelog['description'].str.rsplit('*', 1).str[1].str.strip(), 1))
timelog['description'] = (np.where(timelog['description'].str.contains('\*\s*\d$'), timelog['description'].str.rsplit('*', 1).str[0], timelog['description'])) timelog['description'] = (np.where(timelog['description'].str.contains('\*\s*\d$'), timelog['description'].str.rsplit('*', 1).str[0], timelog['description']))
timelog["time"] = timelog["time"] * timelog['tmp_multiplier'].astype(int) timelog["time"] = timelog["time"] * timelog['tmp_multiplier'].astype(int)
timelog['tmp_multiplier'].drop() timelog.drop(columns=['tmp_multiplier'], inplace=True)
# Clean up description again, after it has been sliced and diced. # Clean up description again, after it has been sliced and diced.
timelog['description'] = timelog['description'].str.strip() timelog['description'] = timelog['description'].str.strip()