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

1461 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

Write a function that takes an imput (call it usr_in), the user's age (usr_age) and the user's name (usr_nm) and outputs the following string: "Hi, My name is [usr_nm], I am [usr_age] years old, and my favorite number is [usr_in]"


What are recursive functions and when should they be used?


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


How might we implement the bubble sort algorithm in Python


We're here to help

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

© MyTutorWeb Ltd 2013–2025

Terms & Conditions|Privacy Policy
Cookie Preferences