Skip to content
Project: Data-Driven Product Management: Conducting a Market Analysis
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
| Column | Description |
|---|---|
'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
| Column | Description |
|---|---|
'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
| Column | Description |
|---|---|
'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
| Column | Description |
|---|---|
'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 pltLoad data on global interest in workouts
# import workout.csv and store in a DataFrame
workout_df = pd.read_csv('data/workout.csv')
print(workout_df.head())workout_df.info()Find the time of peak searches for workout
# Extract the year from the 'month' column
workout_df['year'] = workout_df['month'].str[:4]
# Group by 'year' and sum the 'workout_worldwide' column
grouped_df = workout_df.groupby('year')['workout_worldwide'].sum().reset_index()
# Find the year with the highest workout worldwide
peak_workout = grouped_df.loc[grouped_df['workout_worldwide'].idxmax()]
print(peak_workout)
# Extract the year as a string
year_str = peak_workout.year
print(f"The year of peak workout interest: {year_str}")# Plot the grouped data
fig, ax = plt.subplots()
ax.plot(grouped_df.year, grouped_df.workout_worldwide)
ax.set_xlabel('Year')
ax.set_ylabel('Score')
plt.xticks(rotation=45)
plt.show()Find the most popular keywords for the current year and during covid
# import three_keywords.csv and store in a DataFrame
three_keywords_df = pd.read_csv('data/three_keywords.csv')
print(three_keywords_df.head())three_keywords_df.info()# Extract the year from the 'month' column
three_keywords_df['year'] = three_keywords_df['month'].str[:4]
# Group by 'year' and sum the specified columns
grouped_keywords_df = three_keywords_df.groupby('year').agg({
'home_workout_worldwide':'sum',
'gym_workout_worldwide':'sum',
'home_gym_worldwide':'sum'
}).reset_index()
print(grouped_keywords_df)# Plot the grouped data
fig, ax = plt.subplots()
ax.plot(grouped_keywords_df.year, grouped_keywords_df.home_workout_worldwide, label='Home')
ax.plot(grouped_keywords_df.year, grouped_keywords_df.gym_workout_worldwide, label='Gym')
ax.plot(grouped_keywords_df.year, grouped_keywords_df.home_gym_worldwide, label='Home Gym')
ax.set_xlabel('Year')
ax.set_ylabel('Score')
plt.xticks(rotation=45)
plt.legend()
plt.show()Of the keywords available, what was the most popular during the covid pandemic year (2020), and what was the most popular for 2023?