0% found this document useful (0 votes)
18 views

Pandas Exercises

Pandas excersises

Uploaded by

Ahaan Raza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Pandas Exercises

Pandas excersises

Uploaded by

Ahaan Raza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Python Pandas Test Exercise:-

[In this exercise, we are using Automobile Dataset for data analysis.
This Dataset has different characteristics of an auto such as body-
style, wheel-base, engine-type, price, mileage, horsepower, etc.]

Exercise 1: From the given dataset print the first and last five rows
Expected Output:

Python Pandas printing first 5 rows

Python Pandas printing last 5 rows

Exercise 2: Clean the dataset and update the CSV file


Replace all column values which contain ?, n.a, or NaN.

Exercise 3: Find the most expensive car company name


Print most expensive car’s company name and price.
Expected Output:

Python Pandas printing most costly car name


Exercise 4: Print All Toyota Cars details
Expected Output:

Python Pandas printing all Toyota cars data

Exercise 5: Count total cars per company


Expected Outcome:

Python Pandas count total cars per company

Exercise 6: Find each company’s Highest price car


Expected Outcome:
Exercise 7: Find the average mileage of each car making company
Expected Output:
Exercise 8: Sort all cars by Price column
Expected Output:

Python Pandas sort all cars by price column

Exercise 9: Concatenate two data frames using the following


conditions
Create two data frames using the following two dictionaries.
GermanCars = {'Company': ['Ford', 'Mercedes', 'BMV', 'Audi'],
'Price': [23845, 171995, 135925 , 71400]}
japaneseCars = {'Company': ['Toyota', 'Honda', 'Nissan', 'Mitsubishi
'], 'Price': [29995, 23600, 61500 , 58900]}
Expected Output:

Python Pandas concatenate two data frames and create a key for
each data frame.

Exercise 10: Merge two data frames using the following condition
Create two data frames using the following two Dicts, Merge two
data frames, and append the second data frame as a new column to
the first data frame.
Car_Price = {'Company': ['Toyota', 'Honda', 'BMV', 'Audi'], 'Price':
[23845, 17995, 135925 , 71400]}
car_Horsepower = {'Company': ['Toyota', 'Honda', 'BMV', 'Audi'],
'horsepower': [141, 80, 182 , 160]}
Expected Output:

Python Pandas merge two data frames and append new data frame
as a new column.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy