Basics (10).ipynb (14.4 KB)
numeric_cars.isna().sum()
returns:
normalized-losses 37
wheel-base 0
length 0
width 0
height 0
curb-weight 0
engine-size 0
bore 4
stroke 4
compression-rate 0
horsepower 2
peak-rpm 2
city-mpg 0
highway-mpg 0
price 0
dtype: int64
next
numeric_cars = numeric_cars.dropna(subset=['price'])
numeric_cars.isna().sum()
and
numeric_cars = numeric_cars.fillna(numeric_cars.mean())
numeric_cars.isna().sum()
in attempt to remove nan values
but i still get
normalized-losses 37
wheel-base 0
length 0
width 0
height 0
curb-weight 0
engine-size 0
bore 4
stroke 4
compression-rate 0
horsepower 2
peak-rpm 2
city-mpg 0
highway-mpg 0
price 0
dtype: int64
notice that there’s no change to the nan counts or locations aside from the price column.
Click here to view the jupyter notebook file in a new tab