Variantie en Standaarddeviatie Berekenen
Taak
Swipe to start coding
Bereken de variantie en de standaarddeviatie van de kolom 'salary'
met behulp van de pandas
-bibliotheek.
Oplossing
99
1
2
3
4
5
6
7
8
9
10
11
12
# Import library
import pandas as pd
df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/update/ds_salaries_statistics', index_col = 0)
# Calculate the variance
var = df['salary'].var()
# Calculate the standard deviation
std = df['salary'].std()
print('The variace is', round(var, 2))
print('The standard deviation is', round(std, 2))
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 3. Hoofdstuk 6
single
99
1
2
3
4
5
6
7
8
9
10
11
12
# Import library
___
df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/update/ds_salaries_statistics', index_col = 0)
# Calculate the variance
var = ___
# Calculate the standard deviation
std = ___
print('The variace is', round(var, 2))
print('The standard deviation is', round(std, 2))
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.