Update string split method to use keyword arguments for newer Pandas
This commit is contained in:
parent
34eb40a092
commit
7e2175860f
1 changed files with 4 additions and 4 deletions
|
@ -83,8 +83,8 @@ timelog["day_of_week"] = pd.to_datetime(timelog["date"]).dt.day_name()
|
||||||
|
|
||||||
# If a project has been specified (task prefixed with a colon), then put the
|
# If a project has been specified (task prefixed with a colon), then put the
|
||||||
# project in its own column.
|
# project in its own column.
|
||||||
timelog['project'] = (np.where(timelog['description'].str.contains(': '), timelog['description'].str.split(': ', 1).str[0], None))
|
timelog['project'] = (np.where(timelog['description'].str.contains(': '), timelog['description'].str.split(': ', n=1).str[0], None))
|
||||||
timelog['description'] = (np.where(timelog['description'].str.contains(': '), timelog['description'].str.split(': ', 1).str[1], timelog['description']))
|
timelog['description'] = (np.where(timelog['description'].str.contains(': '), timelog['description'].str.split(': ', n=1).str[1], timelog['description']))
|
||||||
|
|
||||||
# Mid-work clean up of description and new project.
|
# Mid-work clean up of description and new project.
|
||||||
timelog['description'] = timelog['description'].str.strip()
|
timelog['description'] = timelog['description'].str.strip()
|
||||||
|
@ -160,8 +160,8 @@ for preferred, alternatives in compound_project_tasks.items():
|
||||||
|
|
||||||
# If a compound project was specified, break that out into a sub-project (in
|
# If a compound project was specified, break that out into a sub-project (in
|
||||||
# Harvest, we use Task, which is really task type, for this).
|
# Harvest, we use Task, which is really task type, for this).
|
||||||
timelog['subproject'] = (np.where(timelog['project'].str.contains(' — '), timelog['project'].str.split(' — ', 1).str[1], None))
|
timelog['subproject'] = (np.where(timelog['project'].str.contains(' — '), timelog['project'].str.split(' — ', n=1).str[1], None))
|
||||||
timelog['project'] = (np.where(timelog['project'].str.contains(' — '), timelog['project'].str.split(' — ', 1).str[0], timelog['project']))
|
timelog['project'] = (np.where(timelog['project'].str.contains(' — '), timelog['project'].str.split(' — ', n=1).str[0], timelog['project']))
|
||||||
|
|
||||||
# Replace irregular-but-known project names with ones timetracking tools use.
|
# Replace irregular-but-known project names with ones timetracking tools use.
|
||||||
harvest_project_names = {
|
harvest_project_names = {
|
||||||
|
|
Loading…
Reference in a new issue