A trend is a sustained pattern of change in a variable across an ordered period. Analysts use trends to describe data, develop metrics, size opportunities, and support stakeholder decisions without manipulating a test condition. section 3.2.1
Useful descriptive treatments include:
- Plot observations over time to reveal overall movement and potential changes in the variable. section 3.2.1
- Aggregate observations by month and compare totals, means, or medians when a daily series is too detailed. section 3.2.1
- Choose descriptive statistics carefully after exploring the dataset and considering what omitted measures cannot show. section 3.2.1
rats = rats.reset_index()
rats["day"] = pd.to_datetime(rats["day"], format="%m/%d/%y") #1
rats_group = rats.groupby(pd.Grouper(key="day", axis=0, freq="ME")).agg(
["sum", "mean", "median"]
) #2
rats_group.columns = rats_group.columns.get_level_values(1) #3
plt.plot(rats_group["sum"]) #4
plt.xlabel("Month (Starting 1/1/2018)")
plt.ylabel("# of Rat Sightings")
This example groups rat sightings by month and plots monthly sums, providing a practical view of an aggregate trend. section 3.2.1



