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
import pandas as pd

df1 = pd.read_csv("data/workout.csv")

year_str_try = df1.groupby("month")["workout_worldwide"].sum().sort_values(ascending=False).head(1)
print(year_str_try)

#diff approach
plt.figure(figsize=(12, 6))
plt.plot(df1["month"], df1["workout_worldwide"])
plt.xticks(rotation=90)
plt.show()
year_str = "2020"
import pandas as pd

df2 = pd.read_csv("data/three_keywords.csv")

# Ensure the 'month' column is in datetime format
df2["month"] = pd.to_datetime(df2["month"])

# Filter the dataframe for the date range
covid_filtered_df = df2[(df2["month"] >= "2019-11-01") & (df2["month"] <= "2023-12-31")]
covid_filtered_df_max = covid_filtered_df.sum(numeric_only=True).sort_values(ascending=False).head()
print(covid_filtered_df_max)
peak_covid = "home_workout_worldwide"

current_filtered_df = df2[(df2["month"] >= "2023-01-01") & (df2["month"] <= "2023-12-31")]
current_filtered_df_max = current_filtered_df.sum(numeric_only=True).sort_values(ascending=False).head()
print(current_filtered_df_max)
current = "gym_workout_worldwide"

#diff approach
plt.plot(df2["month"], df2["home_workout_worldwide"], label="Home workout")
plt.plot(df2["month"], df2["gym_workout_worldwide"], label="Gym workout")
plt.plot(df2["month"], df2["home_gym_worldwide"], label="Home gym")
plt.xticks(rotation=90)
plt.legend()
plt.show()




print(df2)
df3 = pd.read_csv("data/workout_geo.csv")
top_country = df3.groupby("country")["workout_2018_2023"].sum().sort_values(ascending = False).head()
print(top_country)
top_country = "United States"

#diff approach
df_workout_geo = pd.read_csv("data/workout_geo.csv", index_col = 0)
print(df_workout_geo.loc["United States"])
print(df_workout_geo.loc["Australia"])
print(df_workout_geo.loc["Japan"])

top_country = "United States"
print(df3.head())
import pandas as pd

df4 = pd.read_csv("data/three_keywords_geo.csv")

home_workout_geo = df4[df4["Country"].isin(["Philippines", "Malaysia"])].groupby("Country")["home_workout_2018_2023"].sum().sort_values(ascending= False).head()
print(home_workout_geo)

#diff appraoach
df_keywords_geo = pd.read_csv("data/three_keywords_geo.csv", index_col = 0)
print(df_keywords_geo.loc["Philippines", :])
print(df_keywords_geo.loc["Malaysia", :])

home_workout_geo = "Philippines"

print(df4.head())