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
# Reading all the files
workout_csv= pd.read_csv("data/workout.csv")
three_keywords_csv= pd.read_csv("data/three_keywords.csv")
workout_geo_csv= pd.read_csv("data/workout_geo.csv")
three_keywords_geo_csv= pd.read_csv("data/three_keywords_geo.csv")

#printing the head to get an idea of the data
print(workout_csv.head())
# creating a new column for just years
workout_csv["year"] = workout_csv["month"].str[:4].astype(int)

# checking the sum 
print(workout_csv.groupby("year")["workout_worldwide"].sum())

# plotting the sum
workout_csv.groupby("year")["workout_worldwide"].sum().plot(kind="bar")
plt.show()

# global search for the keyword 'workout' peak year
year_str = "2020"
three_keywords_csv["year"] = three_keywords_csv["month"].str[:4].astype(int)
print(three_keywords_csv.head())

three_keywords_csv[["home_workout_worldwide","gym_workout_worldwide", "home_gym_worldwide"]].plot()
plt.show()

three_keywords_sum = three_keywords_csv.groupby("year")["home_workout_worldwide","gym_workout_worldwide","home_gym_worldwide"].sum().sort_values("year").plot(kind="bar")
plt.show()

current = "gym_workout_worldwide"
peak_covid = "home_workout_worldwide"
top = three_keywords_geo_csv[three_keywords_geo_csv["Country"].isin(["United States", "Australia", "Japan"])]



top_one = top.groupby("Country")[["home_workout_2018_2023", "gym_workout_2018_2023"]].sum()



print(top_one)


top_country = top_one.sum(axis=1)

print(top_country)

top_country = "United States"

top

MML = three_keywords_geo_csv[three_keywords_geo_csv["Country"].isin(["Philippines", "Malaysia"])]

MMLL = MML.groupby("Country")[["home_workout_2018_2023"]].sum()

home_workout_geo = MMLL.sum(axis=1)

print(home_workout_geo)

home_workout_geo = "Philippines"