Categories We Write About

Build a “year in review” data visualizer

To build a “Year in Review” Data Visualizer, the tool should aggregate, analyze, and display key events, metrics, and highlights from a dataset spanning a full year. Here’s a breakdown of how to structure and implement this in a simple yet powerful way using Python with Streamlit for interactivity and Pandas + Plotly for data analysis and visualization.


Features of the Year-in-Review Visualizer

  1. Upload Dataset (CSV/JSON)

  2. Auto-detect Time Column

  3. Monthly Summary Stats (views, revenue, etc.)

  4. Top Events/Peaks Detection

  5. Interactive Charts:

    • Time Series Trends

    • Heatmaps

    • Top Contributors

  6. Word Cloud for Textual Insights

  7. Export Summary Report


Code Implementation (Streamlit App)

python
import streamlit as st import pandas as pd import plotly.express as px import calendar from wordcloud import WordCloud import matplotlib.pyplot as plt st.set_page_config(page_title="Year in Review", layout="wide") st.title("📊 Year in Review - Data Visualizer") # Upload Section uploaded_file = st.file_uploader("Upload your yearly dataset (CSV or JSON)", type=["csv", "json"]) if uploaded_file: # Load Data if uploaded_file.name.endswith('.csv'): df = pd.read_csv(uploaded_file, parse_dates=True) else: df = pd.read_json(uploaded_file) # Try detecting datetime columns time_col = st.selectbox("Select a datetime column", options=df.columns[df.dtypes == 'object'].tolist() + df.columns[df.dtypes == 'datetime64[ns]'].tolist()) try: df[time_col] = pd.to_datetime(df[time_col]) except: st.error("Could not parse the selected column as datetime.") st.stop() df['Month'] = df[time_col].dt.month df['Month Name'] = df['Month'].apply(lambda x: calendar.month_abbr[x]) df['Year'] = df[time_col].dt.year df['Date'] = df[time_col].dt.date numeric_cols = df.select_dtypes(include=['number']).columns.tolist() st.subheader("📅 Monthly Summary") selected_metric = st.selectbox("Choose a metric to review", options=numeric_cols) monthly_summary = df.groupby('Month Name')[selected_metric].sum().reindex(calendar.month_abbr[1:]) fig = px.bar(monthly_summary, x=monthly_summary.index, y=monthly_summary.values, labels={'x': 'Month', 'y': selected_metric}) st.plotly_chart(fig, use_container_width=True) st.subheader("📈 Trends Over Time") trend_fig = px.line(df.sort_values(time_col), x=time_col, y=selected_metric, title=f"{selected_metric} Over Time") st.plotly_chart(trend_fig, use_container_width=True) st.subheader("🔥 Peak Events") top_rows = df.sort_values(by=selected_metric, ascending=False).head(5) st.dataframe(top_rows[[time_col, selected_metric]]) st.subheader("💬 Word Cloud from Text Columns") text_cols = df.select_dtypes(include='object').columns.tolist() text_col = st.selectbox("Select a column for word cloud (optional)", options=[""] + text_cols) if text_col: text_data = " ".join(df[text_col].dropna().astype(str).values) wordcloud = WordCloud(width=800, height=400, background_color='white').generate(text_data) plt.figure(figsize=(10, 5)) plt.imshow(wordcloud, interpolation='bilinear') plt.axis('off') st.pyplot(plt) st.subheader("📥 Download Summary") summary_df = pd.DataFrame({ "Month": monthly_summary.index, selected_metric: monthly_summary.values }) st.download_button("Download Monthly Summary", data=summary_df.to_csv(index=False), file_name="year_summary.csv", mime="text/csv")

How to Use

  1. Run the app with:

    bash
    streamlit run year_in_review.py
  2. Upload a dataset (e.g., sales data, user activity logs, social media insights).

  3. Select the date column and the metric to analyze.

  4. Explore auto-generated charts and summaries.


Ideal Use Cases

  • Marketing Analytics: Review campaign performance month-by-month.

  • E-commerce: Visualize revenue, orders, returns over the year.

  • Content Creators: Summarize video views, likes, top posts.

  • HR/Team Management: Annual productivity or engagement review.


Let me know if you want a version of this deployed on a web server or integrated into a specific platform (like Notion, Airtable, etc.).

Share This Page:

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories We Write About