This Pandas exercise project will help Python developers to learn and practice pandas. Pandas is an open-source, BSD-licensed Python library. Pandas is a handy and useful data-structure tool for analyzing large and complex data.
Practice DataFrame, Data Selection, Group-By, Series, Sorting, Searching, statistics. Practice Data analysis using Pandas.
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.
Also Read:
What included in this Pandas exercise?
- It contains 10 questions. The solution is provided for each question.
- Each question includes a specific Pandas topic you need to learn.
When you complete each question, you get more familiar with data analysis using pandas.
Exercise 1: From the given dataset print the first and last five rows
Expected Output:
Show Solution
Print first five rows
Print last five rows
Exercise 2: Clean the dataset and update the CSV file
Replace all column values which contain ?
, n.a
, or NaN
.
Show Solution
Exercise 3: Find the most expensive car company name
Print most expensive car’s company name and price.
Expected Output:
Show Solution
Exercise 4: Print All Toyota Cars details
Expected Output:
Show Solution
Exercise 5: Count total cars per company
Expected Outcome:
Show Solution
Exercise 6: Find each company’s Higesht price car
Expected Outcome:
Show Solution
Exercise 7: Find the average mileage of each car making company
Expected Output:
Show Solution
Exercise 8: Sort all cars by Price column
Expected Output:
Show Solution
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]}
Code language: Python (python)
Expected Output:
Show Solution
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]}
Code language: Python (python)
Expected Output: