Document making .contains not a regular expression

This commit is contained in:
benjamin melançon 2021-04-27 22:31:42 -04:00
parent f31c9d4d47
commit 2516b9272d

View file

@ -20,6 +20,8 @@ timelog['description'] = (np.where(timelog['description'].str.contains(': '), ti
# 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.
# Note that contains is regex by default, so we actually have to specify pattern
# and regex false to check if it contains an asterisk!
timelog['tmp_multiplier'] = (np.where(timelog['description'].str.contains(pat='*', regex=False), timelog['description'].str.split('*', 1).str[1], None)) timelog['tmp_multiplier'] = (np.where(timelog['description'].str.contains(pat='*', regex=False), timelog['description'].str.split('*', 1).str[1], None))
timelog['description'] = (np.where(timelog['description'].str.contains(pat='*', regex=False), timelog['description'].str.split('*', 1).str[0], timelog['description'])) timelog['description'] = (np.where(timelog['description'].str.contains(pat='*', regex=False), timelog['description'].str.split('*', 1).str[0], timelog['description']))