Skip to content

Commit

Permalink
TDD Pandas - Use a single operation to create first and last name
Browse files Browse the repository at this point in the history
  • Loading branch information
diligejy committed Jan 20, 2024
1 parent 9bc6320 commit fa70e04
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions PyCon_PL/Test_Driven_Pandas/tests/test_gradebook.py
Original file line number Diff line number Diff line change
@@ -4,12 +4,12 @@

def _create_group(raw_students_group:pd.DataFrame) -> pd.DataFrame:
result = pd.DataFrame()
return result.assign(
result = result.assign(
net_id = raw_students_group["NetID"].str.lower(),
email_address = raw_students_group['Email Address'].str.lower(),
first_name=raw_students_group["Name"].str.split(", ", expand=True)[1],
last_name=raw_students_group["Name"].str.split(", ", expand=True)[0],
)
result[['last_name', 'first_name']] = raw_students_group['Name'].str.split(", ", expand=True)
return result

def generate_gradebook(students_df:pd.DataFrame) -> dict[int, pd.DataFrame]:
return {

0 comments on commit fa70e04

Please sign in to comment.