Suppose we have a file that contains historical weather temperature between years 1948 to 2024 in which we want to look at how January temperatures have changed over time.
import pandas
# Load a file that contains Los Angeles weather data
data = pandas.read_csv('LosAngelesWeather_1948-2024.csv', parse_dates=['date'])
# Keep only January temperatures
data = data[[d.month == 1 for d in data.date]].copy()
data
date precipitation max_tmp min_tmp rain
0 1948-01-01 0.47 51 42 True
1 1948-01-02 0.59 45 36 True
2 1948-01-03 0.42 45 35 True
3 1948-01-04 0.31 45 34 True
4 1948-01-05 0.17 45 32 True
... ... ... ... ... ...
25229 2017-01-27 0.00 54 37 False
25230 2017-01-28 0.00 52 37 False
25231 2017-01-29 0.03 48 37 True
25232 2017-01-30 0.02 45 40 True
25233 2017-01-31 0.00 44 34 False