Solution Review: Cleaning Auto MPG Dataset
This lesson provides the solution to the previous challenge.
We'll cover the following...
Cleaning the dataset #
Press + to interact
import pandas as pddef read_csv():# Define the column names as a listnames = ["mpg", "cylinders", "displacement", "horsepower", "weight", "acceleration", "model_year", "origin", "car_name"]# Read in the CSV file from the webpage using the defined column namesdf = pd.read_csv("auto-mpg.data", header=None, names=names, delim_whitespace=True)return df# Remving outliers from the datadef outlier_detection(df):df = df.quantile([.90, .10])return dfprint(outlier_detection(read_csv()))
According to the problem statement, we need to find percentile from the data Auto MPG Dataset of all columns. Before doing it, we have to read the data first. There is no need to explain how to read the data, as we studied that in ...