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.
# 1
import pandas as pd
import matplotlib.pyplot as plt

workout = pd.read_csv('data/workout.csv')
workout['month'] = pd.to_datetime(workout['month']).dt.year
workout.rename(columns={'month':'year'}, inplace=True)
grouped_workout = workout.groupby('year').sum().reset_index()

year_str = grouped_workout['year'].loc[grouped_workout['workout_worldwide'].idxmax()].astype(str)
print(year_str)

fig, ax = plt.subplots()
ax.plot(grouped_workout['year'], grouped_workout['workout_worldwide']) 

ax.set_title('Worldwide Workouts Over Years')
ax.set_xlabel('Year')  
ax.set_ylabel('Workout Worldwide')  

plt.show()  

# 2
csv = pd.read_csv('data/three_keywords.csv')
csv['month'] = pd.to_datetime(csv['month']).dt.year
csv.rename(columns={'month':'year'}, inplace=True)
grouped = csv.groupby('year').sum().reset_index()

fig, ax = plt.subplots()

ax.plot(csv['year'], csv['home_workout_worldwide'], label='Home Workout Worldwide')
ax.plot(csv['year'], csv['gym_workout_worldwide'], label='Gym Workout Worldwide')
ax.plot(csv['year'], csv['home_gym_worldwide'], label='Home Gym Worldwide')

ax.set_title('Workout Trends Over Time')
ax.set_xlabel('Year')
ax.set_ylabel('Workout Worldwide')
ax.legend()
plt.show()
peak_covid = 'Home Workout'
current = 'Gym Workout' 

# 3

geo = pd.read_csv('data/workout_geo.csv', index_col = 0)
uaj = geo.loc[['United States', 'Australia', 'Japan']]
top_country = uaj['workout_2018_2023'].idxmax()
print(top_country)

# 4
kgeo = pd.read_csv('data/three_keywords_geo.csv', index_col = 0)
phm = kgeo.loc[['Philippines', 'Malaysia']]
home_workout_geo = phm['home_workout_2018_2023'].idxmax()
print(home_workout_geo)