Solution: Task I to Task IV
The solution to the previously assigned challenges: Task I to Task IV.
Brace yourself, it’s time to cover each task turn by turn to work out the project in a systematic manner. You can run each executable and verify the answers for the different values.
Explanation
Task 1: Group the data
To group the columns with their respective values, we need the columns’ names and the data. There was one more requirement. We need to decide on the number of records being grouped but we have to keep it optional. So, we also need a keyword argument: n
. The header of the function looks like:
def group_values_with_columns(orig_data, req_col, **kwargs)
Here, orig_data
is the list (data
) in which the data from the csv file was read beforehand. Additionally, req_col
is required_columns
that we hardcoded before. Look at the following snippet.
Get hands-on with 1400+ tech skills courses.