This project explores the potential correlations between music genres and various mental health conditions such as depression, insomnia, OCD (Obsessive-Compulsive Disorder), and anxiety. By analyzing survey data, we aim to uncover any patterns or trends that suggest certain music preferences may impact mental well-being.
https://www.kaggle.com/datasets/catherinerasgaitis/mxmh-survey-results/data
The data used for this analysis was collected through surveys conducted among individuals reporting their favorite music genres along with self-assessments of their mental health conditions. The dataset is stored in a CSV file named mxmh_survey_results.csv
, located in the Resources
directory.
The project utilizes several Python libraries for data analysis and visualization:
- Pandas: For data manipulation and analysis.
- Scikit-learn (sklearn): For dataset loading.
- Scipy (scipy): For statistical analysis.
- Matplotlib: For creating visualizations.
To run the code locally, follow these steps:
- Clone the repository to your machine:
- git clone
https://github.com/jdanielle12/project1
- git clone
- Navigate to the project directory:
cd project1
- Install the required Python libraries:
pip install -r requirements.txt
- Ensure you have Python installed on your machine.
- Install the project dependencies as described in the installation section.
- Navigate to the notebook file/branch. For example:
Depression.ipynb
from the project explorer. - Open the notebook using the Jupyter extension in VSCode.
- Run the cells within the notebook to execute the analysis interactively.
The project repository is organized into branches corresponding to each mental health condition analyzed:
- Depression: Contains code and analysis related to depression.
- OCD: Contains code and analysis realted to OCD.
- Insomnia: Contains code and analysis related to insomnia.
- Anxiety: Contains code and analysis related to anxiety.
Each branch includes scripts, notebooks, and visualizations specific to the respective mental health condition.
- The CSV data is read into a Pandas DataFrame, with the first column serving as the row index.
- The 'Timestamp' column, which is irrelevant to our analysis, is dropped.
- Rows with missing or NaN (Not a Number) values are removed from the DataFrame to ensure data integrity.
The project investigates the correlation between each mental health condition and favorite music genres using bar charts. Specifically:
- Depression: Correlation with favorite genres.
- OCD: Correlation with favorite genres.
- Insomnia: Correlation with favorite genres.
- Anxiety: Correlation with favorite genres.
To explore the correlations further, we focused on the three most associated genres with each mental health condition:
- Depression:
- Lofi
- Rock
- Hip hop
- OCD:
- Lofi
- Rock
- Hip hop
- Insomnia:
- Lofi
- Rock
- Hip hop
- Anxiety:
- Lofi
- Rock
- Hip hop
For each of these genres, correlations were computed between the respective mental health condition and other variables such age, BPM, and hours of music listening per day.
Various statistics are computed to understand the sample data, including:
- Average age of participants.
- Average scores for each mental health condition (Depression, Anxiety, Insomnia, OCD).
The distributions of age and each mental health condition are visualized using bar charts. Scatter plots illustrate the relationships between age, BPM, hours of music listening per day, and mental health conditions.
Through this analysis, we aim to provide insights into how music preferences may influence mental well-being. The results obtained can serve as a basis for further research and potentially inform interventions or therapeutic approaches leveraging music.
The data used in this project was sourced from Kaggle. We would like to acknowledge and thank the following dataset author:
- Music & Mental Health by Catherine Rasgaitis
- This dataset contains survey responses related to mental health and music preferences. We used this dataset to analyze the correlations between favorite music genres and mental health conditions.
- Randolph Bradley
- Jacqueline Columbro
- Walter Hickman Jr.
- Kyle Kerner
- Jamie McGraner