Search⌘ K
AI Features

Solution Review: Cleaning Auto MPG Dataset

Explore how to clean the Auto MPG dataset by reading data, calculating the 10th and 90th percentiles to detect outliers, and applying cleaning techniques using Pandas. Understand key steps in data cleaning that prepare your dataset for effective analysis and visualization.

We'll cover the following...

Cleaning

...
Python 3.5
import pandas as pd
def read_csv():
# Define the column names as a list
names = ["mpg", "cylinders", "displacement", "horsepower", "weight", "acceleration", "model_year", "origin", "car_name"]
# Read in the CSV file from the webpage using the defined column names
df = pd.read_csv("auto-mpg.data", header=None, names=names, delim_whitespace=True)
return df
# Remving outliers from the data
def outlier_detection(df):
df = df.quantile([.90, .10])
return df
print(outlier_detection(read_csv()))

According to the problem ...