Problems on Data Cleaning and Processing For Machine Learning

1 / 12

Operations on Students' Data

We have the following data of first names, last names and marks of students:

student_first_name = ['Jonas', 'Rob', 'Alex', 'John']
student_last_name = ['Gates', 'Hook', 'Wilson', 'Gray']
marks = [90, 79, 96, 85]

Create a function named create_students_df which:

  • has first_names, last_names and marks as input arguments
  • returns a data frame which looks as shown in the below image.

enter image description here

INSTRUCTIONS
  1. Define a variable student_first_name with and array of elements: ['Jonas', 'Rob', 'Alex', 'John']

  2. Define a variable student_last_name with and array of elements: ['Gates', 'Hook', 'Wilson', 'Gray']

  3. Define a variable marks with and array of elements: [90, 79, 96, 85]

  4. Create the function with the name create_students_df that takes three arguments that takes three arguments first_names, last_names and marks and returns a data frame which looks as shown in the above image.

  5. Your function must return the output, it should not print the output.

  6. Call the function create_students_df with the three arguments student_first_name, student_last_name and marks and assign the returned data frame to students_df.

  7. The first column of the data frame students_df should be Full Name, and the second column should be Marks. Make sure to preserve this order as shown in the image

  8. There should be space between the first name and the last name in the Full Name(ie, the Full Name of the person - whose first name is Jonas and last name is Gates - must be Jonas Gates, but not JonasGates.

See Answer

No hints are availble for this assesment


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...