173k views
3 votes
Create a data frame that has information on 10 best students.

The data frame should have: age, gender, height, weight,
ethnicity& siblings

User Natia
by
7.8k points

1 Answer

0 votes

Final answer:

To create a data frame with information on 10 best students, you can use Python's pandas library. Here is an example of how you can create the data frame.

Step-by-step explanation:

To create a data frame with information on 10 best students, you can use Python's pandas library. Here is an example of how you can create the data frame:

import pandas as pd

# Create a dictionary with the student information
student_data = {
'age': [18, 17, 16, 17, 18, 17, 18, 16, 19, 18],
'gender': ['M', 'F', 'M', 'M', 'F', 'F', 'M', 'F', 'M', 'F'],
'height': [170, 165, 175, 162, 168, 160, 172, 165, 180, 170],
'weight': [60, 55, 70, 50, 65, 45, 68, 52, 75, 62],
'ethnicity': ['Asian', 'Caucasian', 'African American', 'Hispanic', 'Asian', 'Caucasian', 'African American', 'Hispanic', 'Asian', 'Caucasian'],
'siblings': [2, 0, 1, 3, 2, 1, 0, 1, 4, 2]
}

# Create the data frame
df = pd.DataFrame(student_data)

# Print the data frame
print(df)

User GordonShumway
by
7.7k points