From 7e2175860f7f62354c2fd1ac72220d973a9f8173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Melan=C3=A7on?= Date: Mon, 6 Feb 2023 10:03:22 -0500 Subject: [PATCH] Update string split method to use keyword arguments for newer Pandas --- pomodoro_to_harvest.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pomodoro_to_harvest.py b/pomodoro_to_harvest.py index e0accf4..72d117e 100644 --- a/pomodoro_to_harvest.py +++ b/pomodoro_to_harvest.py @@ -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 # project in its own column. -timelog['project'] = (np.where(timelog['description'].str.contains(': '), timelog['description'].str.split(': ', 1).str[0], None)) -timelog['description'] = (np.where(timelog['description'].str.contains(': '), timelog['description'].str.split(': ', 1).str[1], timelog['description'])) +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(': ', n=1).str[1], timelog['description'])) # Mid-work clean up of description and new project. 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 # 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['project'] = (np.where(timelog['project'].str.contains(' — '), timelog['project'].str.split(' — ', 1).str[0], timelog['project'])) +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(' — ', n=1).str[0], timelog['project'])) # Replace irregular-but-known project names with ones timetracking tools use. harvest_project_names = {