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

Load workout.csv, which tracks global interest in the keyword "workout," from the 'data/' folder, and store in a DataFrame.

# Load the workout.csv file into a DataFrame
workout_df = pd.read_csv('data/workout.csv')

# Display the first few rows of the DataFrame to verify
workout_df.head()
# Convert the 'month' column to datetime format
workout_df['month'] = pd.to_datetime(workout_df['month'])

# Create a new column for the year
workout_df['year'] = workout_df['month'].dt.year

# Display the first few rows to verify the changes
workout_df.head()
import matplotlib.pyplot as plt

# Group the data by year and sum the workout searches
yearly_data = workout_df.groupby('year')['workout_worldwide'].sum()

# Plot the total worldwide workout searches per year
yearly_data.plot(kind='bar', color='skyblue')
plt.title('Total Worldwide Workout Searches Per Year')
plt.xlabel('Year')
plt.ylabel('Total Searches')
plt.xticks(rotation=45)
plt.grid(axis='y')
plt.show()
year_str = "2020"
import pandas as pd
three_keywords = pd.read_csv('data/three_keywords.csv')
print(three_keywords.head())
import matplotlib.pyplot as plt

# Convert the 'month' column to datetime format for proper plotting
three_keywords['month'] = pd.to_datetime(three_keywords['month'])

# Plot the trends of each keyword over time
plt.plot(three_keywords['month'], three_keywords['home_workout_worldwide'], label='Home Workout', color='blue')
plt.plot(three_keywords['month'], three_keywords['gym_workout_worldwide'], label='Gym Workout', color='green')
plt.plot(three_keywords['month'], three_keywords['home_gym_worldwide'], label='Home Gym', color='red')

plt.title('Trends of Workout-Related Keywords Over Time')
plt.xlabel('Month')
plt.ylabel('Search Volume')
plt.legend()
plt.xticks(rotation=45)
plt.show()
peak_covid = "home_workout"

current = "gym_workout"
# Determine the most popular keyword during the COVID pandemic
peak_covid = three_keywords[['home_workout_worldwide', 'gym_workout_worldwide', 'home_gym_worldwide']].sum().idxmax()

# Determine the most popular keyword currently (assuming the latest month in the data)
current_month_data = three_keywords.iloc[-1]
current = current_month_data[['home_workout_worldwide', 'gym_workout_worldwide', 'home_gym_worldwide']].astype(float).idxmax()

print(peak_covid)
print(current)
import pandas as pd
import matplotlib.pyplot as plt

workout_geo = pd.read_csv("data/workout_geo.csv")
# Filter the DataFrame for specific countries: United States, Australia, and Japan
filtered_countries = ['United States', 'Australia', 'Japan']
filtered_workout_geo = workout_geo[workout_geo['country'].isin(filtered_countries)]

# Display the filtered DataFrame
filtered_workout_geo
# Determine the country with the highest interest for workouts
# among United States, Australia, and Japan

# Find the country with the maximum workout interest
top_country = filtered_workout_geo.loc[filtered_workout_geo['workout_2018_2023'].idxmax(), 'country']
print(top_country)
top_country = "United States"