From 3560dcf4fc6b15da0f0198537b9bbb8a558df1a5 Mon Sep 17 00:00:00 2001 From: kiran160195 <66009503+kiran160195@users.noreply.github.com> Date: Tue, 10 Jun 2025 16:12:27 -0500 Subject: [PATCH 1/3] Create problem1 --- problem1 | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 problem1 diff --git a/problem1 b/problem1 new file mode 100644 index 0000000..d2f534c --- /dev/null +++ b/problem1 @@ -0,0 +1,7 @@ +import pandas as pd + +def calculate_special_bonus(employees: pd.DataFrame) -> pd.DataFrame: + employees['bonus'] = employees['salary'].where( + (~employees['name'].str.startswith('M')) & (employees['employee_id'] %2 ==1), 0 + ) + return employees[['employee_id','bonus']].sort_values('employee_id') From 4f472b6458421a95fb222980df53ee88e7f854c1 Mon Sep 17 00:00:00 2001 From: kiran160195 <66009503+kiran160195@users.noreply.github.com> Date: Tue, 10 Jun 2025 16:22:19 -0500 Subject: [PATCH 2/3] Create problem2 --- problem2 | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 problem2 diff --git a/problem2 b/problem2 new file mode 100644 index 0000000..b84b2af --- /dev/null +++ b/problem2 @@ -0,0 +1,5 @@ +import pandas as pd + +def fix_names(users: pd.DataFrame) -> pd.DataFrame: + users['name'] = users['name'].str.capitalize() + return users[['user_id','name']].sort_values('user_id') From 76c6c669df1534fe6e4f5a387a459e13191aea89 Mon Sep 17 00:00:00 2001 From: kiran160195 <66009503+kiran160195@users.noreply.github.com> Date: Tue, 10 Jun 2025 18:04:14 -0500 Subject: [PATCH 3/3] Create problem3 --- problem3 | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 problem3 diff --git a/problem3 b/problem3 new file mode 100644 index 0000000..0cadfa4 --- /dev/null +++ b/problem3 @@ -0,0 +1,6 @@ +import pandas as pd + +def find_patients(patients: pd.DataFrame) -> pd.DataFrame: + mask = (patients['conditions'].str.startswith('DIAB1', na=False) | + patients['conditions'].str.contains(' DIAB1', na=False)) + return patients[mask][['patient_id', 'patient_name', 'conditions']]