Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Statistics with pandas | Mean, Median and Mode with Python
Learning Statistics with Python
course content

Contenido del Curso

Learning Statistics with Python

Learning Statistics with Python

1. Basic Concepts
2. Mean, Median and Mode with Python
3. Variance and Standard Deviation
4. Covariance vs Correlation
5. Confidence Interval
6. Statistical Testing

book
Statistics with pandas

The Pandas library already has three built-in functions for calculating the mean and median. To import pandas using the pd alias, use the following syntax:

python

Here's an example of calculating the .mean() and .median() for the 'work_year' column in the dataset named df.

Feel free to change the columns and observe the results:

1234567891011
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) # Calculating the mean value mean = df['work_year'].mean() # Calculating the median value median = df['work_year'].median() print('The mean value is', mean) print('The median value is', median)
copy

To calculate key statistical values, use methods designed for handling measurements, such as:

python
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 3

Pregunte a AI

expand
ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

course content

Contenido del Curso

Learning Statistics with Python

Learning Statistics with Python

1. Basic Concepts
2. Mean, Median and Mode with Python
3. Variance and Standard Deviation
4. Covariance vs Correlation
5. Confidence Interval
6. Statistical Testing

book
Statistics with pandas

The Pandas library already has three built-in functions for calculating the mean and median. To import pandas using the pd alias, use the following syntax:

python

Here's an example of calculating the .mean() and .median() for the 'work_year' column in the dataset named df.

Feel free to change the columns and observe the results:

1234567891011
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) # Calculating the mean value mean = df['work_year'].mean() # Calculating the median value median = df['work_year'].median() print('The mean value is', mean) print('The median value is', median)
copy

To calculate key statistical values, use methods designed for handling measurements, such as:

python
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 3
Lamentamos que algo salió mal. ¿Qué pasó?
some-alt