Skip to content

You are a product manager for a fitness studio and are interested in understanding the current demand for digital fitness classes. You plan to conduct a market analysis in Python to gauge demand and identify potential areas for growth of digital products and services.

The Data

You are provided with a number of CSV files in the "Files/data" folder, which offer international and national-level data on Google Trends keyword searches related to fitness and related products.

workout.csv

ColumnDescription
'month'Month when the data was measured.
'workout_worldwide'Index representing the popularity of the keyword 'workout', on a scale of 0 to 100.

three_keywords.csv

ColumnDescription
'month'Month when the data was measured.
'home_workout_worldwide'Index representing the popularity of the keyword 'home workout', on a scale of 0 to 100.
'gym_workout_worldwide'Index representing the popularity of the keyword 'gym workout', on a scale of 0 to 100.
'home_gym_worldwide'Index representing the popularity of the keyword 'home gym', on a scale of 0 to 100.

workout_geo.csv

ColumnDescription
'country'Country where the data was measured.
'workout_2018_2023'Index representing the popularity of the keyword 'workout' during the 5 year period.

three_keywords_geo.csv

ColumnDescription
'country'Country where the data was measured.
'home_workout_2018_2023'Index representing the popularity of the keyword 'home workout' during the 5 year period.
'gym_workout_2018_2023'Index representing the popularity of the keyword 'gym workout' during the 5 year period.
'home_gym_2018_2023'Index representing the popularity of the keyword 'home gym' during the 5 year period.
# Import the necessary libraries
import pandas as pd
import matplotlib.pyplot as plt
# workout csv
workout_data = pd.read_csv("./data/workout.csv")
workout_data = workout_data.dropna()
workout_data.head()
# three_keywords csv
three_keywords_data = pd.read_csv("./data/three_keywords.csv")
three_keywords_data = three_keywords_data.dropna()
three_keywords_data.head()
# workout_geo_data csv
workout_geo_data = pd.read_csv("./data/workout_geo.csv")
workout_geo_data = workout_geo_data.dropna()
workout_geo_data.head()
# three_keywords_geo csv
three_keywords_geo_data = pd.read_csv("./data/three_keywords_geo.csv")
three_keywords_geo_data = three_keywords_geo_data.dropna()
three_keywords_geo_data.head()

Now that we imported the data our goal is to find the peak workout year

workout_worldwide_max = workout_data["workout_worldwide"].max()
print(workout_worldwide_max)
print(workout_data[workout_data["workout_worldwide"] == workout_worldwide_max])
year_str = "2020" # most searches for workouts were made in 2020 april
# Convert 'month' to datetime for better handling
three_keywords_data["month"] = pd.to_datetime(three_keywords_data["month"])

# Define a function to plot the data
def plot_keyword_trend(data, keyword, title):
    plt.figure(figsize=(12, 6))
    plt.plot(data["month"], data[keyword], label=title)
    plt.xlabel("Year")
    plt.ylabel("Search Interest")
    plt.title(f"Search Interest Over Time for {title}")
    plt.legend()
    plt.xticks(
        data["month"][::12],  # Show only the first month of each year
        data["month"].dt.year[::12],  # Extract the year
        rotation=45
    )
    plt.show()

# Plot Home Workout
plot_keyword_trend(three_keywords_data, "home_workout_worldwide", "Home Workout")

# Plot Gym Workout
plot_keyword_trend(three_keywords_data, "gym_workout_worldwide", "Gym Workout")

# Plot Home Gym
plot_keyword_trend(three_keywords_data, "home_gym_worldwide", "Home Gym")
peak_covid = "home_workout_worldwide"
current = "gym_workout_worldwide"
sorted_workout_geo = workout_geo_data.sort_values(by="workout_2018_2023", ascending=False)
print(sorted_workout_geo.head())
top_country = "United States"
# Filter the data for the Philippines and Malaysia
philippines_data = three_keywords_geo_data[three_keywords_geo_data["Country"] == "Philippines"]
malaysia_data = three_keywords_geo_data[three_keywords_geo_data["Country"] == "Malaysia"]

# Compare the interest in home workouts between the two countries
philippines_home_workout = philippines_data["home_workout_2018_2023"].values[0]
malaysia_home_workout = malaysia_data["home_workout_2018_2023"].values[0]

# Determine which country has the highest interest in home workouts
if philippines_home_workout > malaysia_home_workout:
    home_workout_geo = "Philippines"
else:
    home_workout_geo = "Malaysia"

home_workout_geo