Question: loc and iloc ( 3 ) It's also possible to select only columns with loc and iloc. In both cases, you simply put a slice
loc and iloc
It's also possible to select only columns with loc and iloc. In both cases, you simply put a slice going from beginning to end in front of the comma:
cars.loc: 'country'
cars.iloc:
cars.loc:country'drivesright'
cars.iloc:
Instructions
XP
Print out the drivesright column as a Series using loc or iloc.
Print out the drivesright column as a DataFrame using loc or iloc.
Print out both the carspercap and drivesright column as a DataFrame using loc or iloc.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
