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)

Answered by Lucia R. Python tutor

1401 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

What is the difference between using range() and a list of values?


Write a simple Python program that asks a user to input their age and name and then return the text: "Hi my name is *NAME*, and I am *AGE* years old."


What can be used to iterate through a list in python?


Write a program that computes the sum of all numbers up to a input number n


We're here to help

contact us iconContact usWhatsapp logoMessage us on Whatsapptelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo
Cookie Preferences