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 

#creating dataframes
workout = pd.read_csv("data/workout.csv")
keywords = pd.read_csv("data/three_keywords.csv")
workout_geo = pd.read_csv("data/workout_geo.csv", index_col= 0)
keywords_geo = pd.read_csv("data/three_keywords_geo.csv", index_col= 0)


# 1.workout.csv 
workout['year'] = pd.to_datetime(workout['month']).dt.year
peak_year = workout.loc[workout['workout_worldwide'].idxmax(), 'year']
#visualization
plt.figure(figsize=(16, 8))
plt.grid()
plt.plot(workout["month"], workout["workout_worldwide"])
plt.xticks(rotation=90)
plt.show()
#from plot
year_str = "2020"


# 2.three_keywords.csv
keywords['year'] = pd.to_datetime(keywords['month']).dt.year
covid_data = keywords[(keywords['year'] >= 2020) & (keywords['year'] <= 2021)]
current_data = keywords[(keywords['year'] >= 2024) & (keywords['year'] >= 2025)]
#most common words
covid_means = covid_data[['home_workout_worldwide', 'gym_workout_worldwide', 'home_gym_worldwide']].mean()
current_means = current_data[['home_workout_worldwide', 'gym_workout_worldwide', 'home_gym_worldwide']].mean()
peak_covid = covid_means.idxmax()
current = current_means.idxmax()
#visualization
plt.figure(figsize=(16, 8))
plt.grid()
plt.plot(keywords["month"], keywords["home_workout_worldwide"], label="Home workout")
plt.plot(keywords["month"], keywords["gym_workout_worldwide"], label="Gym workout")
plt.plot(keywords["month"], keywords["home_gym_worldwide"], label="Home gym")
plt.xticks(rotation=90)
plt.legend()
plt.show()
#from plot
peak_covid = "home workout"
current = "gym workout"



# 3.workout_geo.csv
print(workout_geo.loc["United States"])
print(workout_geo.loc["Australia"])
print(workout_geo.loc["Japan"])
top_country = "United States"



# 4.keywords_geo.csv
#print(keywords_geo.loc["Philippines", :])
#print(keywords_geo.loc["Malaysia", :])
home_workout_geo = 'Philippines'
 
#results
print(f"Year of peak worldwide interest in 'workout': {peak_year}")
print(f"Most popular keyword during COVID: {peak_covid}")
print(f"Most popular keyword currently: {current}")
print(f"Country with highest interest in 'workout': {top_country}")
print(f"Country with highest interest in 'home workout': {home_workout_geo}")
# Start coding here