Question: Data frames can be subset by a chosen value using = = . Ex: df [ df . x = = 5 ] gives all

Data frames can be subset by a chosen value using ==.
Ex: df[df.x ==5] gives all the rows in the data frame df for which the column x has a value of 5.
Write a program that performs the following tasks:
Load the file mtcars.csv into a data frame called df
Create a new data frame df_cyl by subsetting the data frame based on a user defined value for the column cyl.
Print the shape of the new data frame.
Ex: If the input is:
4
the output is:
(11,12)

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 Databases Questions!