Session 05: Probability¶
I as a novice, it is quite difficult the understand the concepts of coding and programming. However, I remain thankful to the resource persons, colleagues for helping me to learn the code.¶
I feel learning is made easier with having access to AI assistance, in particular, Chatgpt for enabling us the run the text code and test it in Jupyter lab.¶
Probability Distribution of my data- Fire counts¶
Modeling Histogram¶
In [2]:
# Import necessary libraries
import pandas as pd
import matplotlib.pyplot as plt
# Load the CSV data
data = pd.read_csv("datasets/firecounts.csv")
# Display first few rows to verify
print(data.head())
# Extract the 'Fire Counts' column
fire_counts = data['Fire Counts']
# Create a probability histogram
plt.figure(figsize=(10,6))
plt.hist(fire_counts, bins=10, density=True, edgecolor='black', alpha=0.7) # density=True makes it a probability histogram
plt.title('Fire Counts (2001-2024)')
plt.xlabel('Number of Fires')
plt.ylabel('Probability')
plt.grid(axis='y', linestyle='--', alpha=0.7)
plt.show()
Year Fire Counts 0 2001 199 1 2002 127 2 2003 170 3 2004 219 4 2005 204