Last active
March 6, 2023 03:04
-
-
Save lundquist-ecology-lab/0bbae810fb8dfa4a67a5a1377febffee to your computer and use it in GitHub Desktop.
Basic summary stats using pandas in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Calculating mean, and other summary statistics in Python with examples | |
import pandas as pd | |
import numpy as np | |
from palmerpenguins import load_penguins | |
penguins = load_penguins() | |
bill_length_mm = penguins['bill_length_mm'].dropna() | |
# Sample mean | |
mean = np.mean(bill_length_mm) | |
# Sample standard deviation | |
std_dev = np.std(bill_length_mm) | |
# Sample size | |
n = len(bill_length_mm) | |
# Summary stats using pandas | |
print(bill_length_mm.describe()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment