Skip to content

Introduction to Statistics in Python

Run the hidden code cell below to import the data used in this course.

# Importing numpy and pandas
import numpy as np
import pandas as pd

# Importing the course datasets
deals = pd.read_csv("datasets/amir_deals.csv")
happiness = pd.read_csv("datasets/world_happiness.csv")
food = pd.read_csv("datasets/food_consumption.csv")

Take Notes

Add notes about the concepts you've learned and code cells with code you want to keep.

Add your notes here

# Add your code snippets here
# Assuming amir_deals is a DataFrame, we need to define it first.
import pandas as pd

# Example data for amir_deals
data = {
    'product': ['A', 'B', 'A', 'C', 'B', 'A', 'C', 'C', 'B', 'A']
}
amir_deals = pd.DataFrame(data)

# Count the deals for each product
counts = amir_deals['product'].value_counts()
print(counts)
# Calculate probability of picking a deal with each product
probs = counts / amir_deals.shape[0]
print(probs)