Python in Excel: How to visualize seasonality
Want to share your content on python-bloggers? click here.
Visualizing seasonality is a critical analytical skill in business because many essential metrics like sales, revenue, or demand often follow predictable seasonal patterns. Understanding these patterns helps businesses anticipate periods of peak activity, manage inventory, allocate resources effectively, and create accurate forecasts.
Python in Excel makes seasonal analysis especially straightforward. Unlike traditional Excel, where handling and grouping date-based data can become complex or cumbersome, Python seamlessly manages dates and periods, enabling intuitive grouping, aggregation, and visualization.
Ready to see this in action? Follow along using the famous airline passengers dataset by downloading the exercise file below:
Before we start visualizing seasonal patterns, we need to prepare our dataset by extracting date-related components. The original file contains a month
column in date format, so we first convert it using pd.to_datetime()
to ensure pandas recognizes it as a proper datetime object.
From there, we extract the year, month name, and month number, storing each in its own column. These new fields allow us to group, sort, and plot the data by month and year: critical for showing seasonality over time. This simple prep step makes the upcoming visualizations far easier to build and interpret in Python.
Seasonal overlay plot
With the data set up, our first visualization is a line chart showing airline passenger counts for each month, with separate lines representing each year. To highlight growth across this period, we’re labeling selected years (1949, 1955, and 1960) at their December data points. It would be possible to label every year, but neatly positioning all these labels is tricky in Python in Excel without access to external libraries like adjustText
, which manage overlapping labels automatically.
This plot clearly reveals recurring seasonal patterns: passenger volumes consistently peak around mid-year, particularly July and August, before declining toward December. Overlaying multiple years helps to compare these seasonal cycles directly, allowing us to quickly assess consistency across time periods and identify overall growth trends. Seeing each year as its own line makes it easy to recognize both typical seasonal fluctuations and any unusual deviations, making this visualization especially valuable for exploratory analysis and trend identification.

To be fair, you could easily make a plot like this in Excel using PivotTables. But rather than linger on what’s simple in Excel, let’s keep moving and check out some visualizations Python handles even more gracefully.
Seasonal subseries plot
In the next plot, we’re first creating a boxplot for each month using seaborn’s boxplot()
. These boxes illustrate the typical passenger counts—showing medians (the central line), interquartile ranges (the box itself), and overall distribution (the whiskers). Next, we layer a stripplot with individual data points jittered to prevent overlapping, providing extra transparency and detail about each month’s specific data.
The resulting visualization highlights seasonal patterns in the passenger dataset. You can quickly see that passenger numbers tend to rise consistently from January, peak strongly during mid-year (particularly July and August), and then gradually decrease toward year’s end. Additionally, the combination of boxplot and individual data points reveals the month-to-month variability and potential outliers—months like July show a higher median and greater spread, while months such as November show lower and tighter distributions. This helps analysts clearly understand not only the typical monthly passenger counts but also how consistent or variable each month’s pattern is.

Small multiples plot
In this next visualization, we’re creating a small multiples plot (also known as a facet grid) to examine monthly passenger trends individually, year-over-year. Using seaborn’s FacetGrid
, we’ve broken the data into twelve distinct subplots; one for each month. Within each subplot, the gray line shows how passenger counts for that month changed from year to year, allowing us to easily track long-term trends month-by-month.
Additionally, we’ve calculated and drawn a horizontal dashed line representing the average passenger count for each month across all years. This provides a useful benchmark, helping us quickly assess whether a given month in a particular year was above or below its long-term average.

This type of visualization is valuable because it separates seasonal effects from broader trends. We clearly see the growth pattern repeated across months, confirming an overall increasing passenger volume year by year. At the same time, individual facets let us assess each month separately, which highlights whether certain months grew faster or slower relative to their historical averages. This structured view helps analysts and decision-makers identify subtle variations or exceptional cases more quickly than by looking at a single aggregated plot.
Seasonal heatmap
To wrap things up, we have a seasonal heatmap visualization created with seaborn’s heatmap()
function. The dataset has been pivoted so that each row represents a year, each column represents a month, and each cell displays the number of airline passengers. Colors ranging from pale yellow (low passenger counts) to deep blue (high passenger counts) illustrate the intensity of passenger traffic clearly and immediately.
This visualization helps us quickly grasp patterns and trends at a glance. As you scan from left to right, the seasonal pattern we’ve previously seen becomes very apparent—passenger numbers consistently peak around July and August, as indicated by the darker colors in those months. Scanning from top to bottom (earlier to later years), the deepening shades of blue illustrate the overall upward trend in passenger traffic across the entire dataset..

Conclusion
Being able to visualize seasonality using Python in Excel offers significant advantages to analysts. Python streamlines date management, simplifies the aggregation of data across time periods, and provides flexible and insightful visualizations that can deepen your analytical insights and decision-making abilities.
However, it’s important to recognize some limitations. Python in Excel currently doesn’t support certain advanced visualization features readily available through dedicated Python libraries, such as automated label adjustment or highly interactive plots. For tasks requiring very detailed customizations, you may still need standalone Python environments.
A natural next step would be exploring seasonal decomposition, a more robust and statistically rigorous technique for analyzing seasonality. Seasonal decomposition breaks down a time series into clear components—trend, seasonal, and residual—which sets you up perfectly for forecasting future values. Applying this method will further enhance your analytical capabilities and precision in forecasting.
If you have any questions about visualizing seasonality or Python in Excel more broadly, I’d love to hear from you! Drop your comments and questions below.
The post Python in Excel: How to visualize seasonality first appeared on Stringfest Analytics.
Want to share your content on python-bloggers? click here.