With the help of Pandas and Numpy library create a DataFrame with the columns "Name", "Surname", "Age" and "Gender", create as many rows as you want. Print out the result.

import pandas as pdimport numpy as npdf = pd.DataFrame(np.array([["John", "Smith", 23, "Male"], ["Emily", "Adams", 19, "Female"]]), columns=['Name', 'Surname', 'Age', 'Gender'])print(df)

LR
Answered by Lucia R. Python tutor

1524 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

What does __init__ mean?


Why would I use dictionaries instead of a list?


Write a program that takes a value x and then outputs x Fibonnaci numbers. E.g. if x=6 output would be 1 1 2 3 5 8


Write a function that takes a string, and outputs that string formatted in camelcase. (alternating upper and lower case for each character, e.g. cAmElCaSe)


We're here to help

contact us iconContact ustelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

© MyTutorWeb Ltd 2013–2025

Terms & Conditions|Privacy Policy
Cookie Preferences