Question: a ) From these three lists, create a dataframe df where the column names are the list names and the list elements are the values

a) From these three lists, create a dataframe df where the column names are the list names and the list elements are the values in the df columns.
Country =['USA', 'China', 'India', 'Japan', 'Germany', 'UK', 'France']
GDP =[21.43,14.34,2.87,5.08,4.00,2.83,2.71]
Population =[331,1444,1393,126,83,66,67]
b) Check the index values of the dataframe.
c) Set the country names as the index of df. Print index of df.
d) Use loc to print the first three rows.
e) Use .iloc to print the first three rows.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!