Hello everyone, I need help, maybe someone has already encountered this, https://www.codecademy.com/exams/journeys/data-scientist-aly/paths/dsalycj-22-statistics-for-data-scientists/parts/2 I can’t finish the exam, I just stuck in 2 places, and for a couple of days I’ve been standing still
The dataset loaded in the code editor is FiveThirtyEight’s Candy Power Rankings dataset. The column winpercent
represents the overall win percentage according to 269,000 matchups.
Calculate the variance, standard deviation and interquartile range of this field, save them as var
, std
and iqr
respectively and print them.
Here is my code
import numpy as np
import pandas as pd
from scipy.stats import iqr
Loading the dataset
df = pd.read_csv(‘candy-data.csv’)
Calculate the variance of the winpercent column
var = df.winpercent.var()
Calculate the standard deviation of the winpercent column
std = df.winpercent.std()
Calculate the interquartile range (IQR) of the winpercent column
iqr_value = iqr(df.winpercent)
Print the results
print(f"Variance: {var}“)
print(f"Standard Deviation: {std}”)
print(f"Interquartile Range: {iqr_value}")
but it tells
type function doesn’t define round method