Стандартне Відхилення з Python
Перша функція належить до numpy
, а другий метод — до pandas
. Розгляньте приклад обчислення стандартного відхилення для work_year
:
123456789101112import pandas as pd import numpy as np 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 standard deviation using the function from the NumPy library std_1 = np.std(df['salary_in_usd']) # Calculate the standard deviation using the function from the pandas library std_2 = df['salary_in_usd'].std() print('The standard deviation using NumPy library is', round(std_1, 2)) print('The standard deviation using pandas library is', round(std_2, 2))
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 3. Розділ 5
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Suggested prompts:
What is the difference between the standard deviation calculated by NumPy and pandas?
Can you explain why the results from NumPy and pandas might differ?
How does the standard deviation help in understanding the salary data?
Awesome!
Completion rate improved to 2.63
Стандартне Відхилення з Python
Свайпніть щоб показати меню
Перша функція належить до numpy
, а другий метод — до pandas
. Розгляньте приклад обчислення стандартного відхилення для work_year
:
123456789101112import pandas as pd import numpy as np 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 standard deviation using the function from the NumPy library std_1 = np.std(df['salary_in_usd']) # Calculate the standard deviation using the function from the pandas library std_2 = df['salary_in_usd'].std() print('The standard deviation using NumPy library is', round(std_1, 2)) print('The standard deviation using pandas library is', round(std_2, 2))
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 3. Розділ 5