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 CSVs
workout = pd.read_csv("data/workout.csv")
three_keywords = pd.read_csv("data/three_keywords.csv")
workout_geo = pd.read_csv("data/workout_geo.csv")
three_keywords_geo = pd.read_csv("data/three_keywords_geo.csv")
# WORKOUT
workout.head()
workout.info()
# Find the peak for global 'workout' searches by VISUALIZATION 
plt.figure(figsize=(12, 6))
plt.plot(workout["month"], workout["workout_worldwide"])
plt.xticks(rotation=90)
plt.show()
# When was the global search for 'workout' at its peak? Save the year of peak interest as a string named year_str in the format "yyyy".
workout['month'] = pd.to_datetime(workout['month'], format = '%Y-%m')
workout['year'] = workout['month'].dt.year
most_popular_year = workout.groupby('year').sum('workout_worldwide').idxmax()
most_popular_year
year_str = '2020'
# THREE KEYWORDS
three_keywords.head()
# 3 KEYWORDS INFO
three_keywords.info()
# Of the keywords available, what was the most popular during the covid pandemic, and what is the most popular now? Save your answers as variables called peak_covid and current respectively.

plt.figure(figsize=(12, 6))
plt.plot(three_keywords["month"], three_keywords["home_workout_worldwide"], label="home_workout_worldwide")
plt.plot(three_keywords["month"], three_keywords["gym_workout_worldwide"], label="gym_workout_worldwide")
plt.plot(three_keywords["month"], three_keywords["home_gym_worldwide"], label="home_gym_worldwide")

# Add labels and legend
plt.xlabel('Month')
plt.ylabel('Popularity')
plt.title('Popularity of Workout Keywords Over Time')
plt.legend()

# Rotate x-axis labels for better readability
plt.xticks(rotation=90)

# Display the plot
plt.show()
# The most popular keywords during the covid pandemic and now
peak_covid = "home workout"
current = "gym workout"
# WORKOUT GEO
workout_geo.head()
# WORKOUT GEO INFO
workout_geo.info()
# What country has the highest interest for workouts among the following: United States, Australia, or Japan? Save your answer as top_country.
US_AU_JP = workout_geo[workout_geo['country'].isin(['United States', 'Australia', 'Japan'])]
US_AU_JP