basic medium#
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from vega_datasets import data
# if vega_datasets is not installed, you can install it from the
# notebook with
# %pip install vega_datasets
# restart the kernel after installation
let’s load the cars dataset#
cars = data.cars()
Explore the shape and first few lines of the dataset#
# your code
Compute the mean and std for numeric columns#
# your code
Put the name of the columns labels in lower case#
# your code
# check it
cars.head(2)
| Name | Miles_per_Gallon | Cylinders | Displacement | Horsepower | Weight_in_lbs | Acceleration | Year | Origin | |
|---|---|---|---|---|---|---|---|---|---|
| 0 | chevrolet chevelle malibu | 18.0 | 8 | 307.0 | 130.0 | 3504 | 12.0 | 1970-01-01 | USA |
| 1 | buick skylark 320 | 15.0 | 8 | 350.0 | 165.0 | 3693 | 11.5 | 1970-01-01 | USA |
Create a column “consommation (l/km)”, and remove the column miles_per_gallon#
Tip: miles_per_gallon/235.2 = litre_per_100km
# your code
Create a columns “poids (kg)” and remove the column weight_in_lbs#
Tip: 1lb = 0.454 kg
# your code
Count the number of different origin#
# your code
Check the memory usage of the origin column, convert the column ‘origin’ to category, check the new memory usage*#
# your code