This notebook was used to write the blog post A Year in Time: My 2024 Google Calendar Analysis, which analyzes how I spent my time in 2024 based on my Google Calendar data. The gcal_analysis_2024.ipynb
etches, processes, and visualizes event data, generating insights on time spent across categories, word clouds, and monthly hour distributions. It can also be adapted for other years.
- Fetches events from Google Calendar using OAuth 2.0 authentication.
- Analyzes event data to calculate total hours spent on various categories.
- Generates a word cloud visualization of event summaries.
- Provides insights into event distribution over weeks and months.
To run this project, you need the following Python packages:
pytz
matplotlib
pandas
collections
statistics
google-auth
google-auth-oauthlib
google-api-python-client
You can install the required packages using pip:
pip install pytz matplotlib pandas google-auth google-auth-oauthlib google-api-python-client
-
Clone the Repository:
Clone this repository to your local machine:
git clone [email protected]:eltsai/gcal_analysis.git cd gcal_analysis
-
Google Calendar API Setup:
- Go to the Google Cloud Console.
- Create a new project.
- Enable the Google Calendar API for your project.
- Create OAuth 2.0 credentials and download the
credentials.json
file. - Place the
credentials.json
file in the project directory.
-
Run the Jupyter Notebook:
Open
gcal_analysis_2024.ipynb
and run the cells to fetch and analyze your Google Calendar events.
- The notebook is structured into several sections:
- Fetch Data From Google Calendar: This section handles authentication and fetching events.
- Load Data: Loads the fetched event data from a JSON file (you'll probably need to rewrite the mapping between color and category).
- Data Analysis: Analyzes the events to calculate total hours spent on different categories.
- Visualizations: Generates visualizations such as word clouds and monthly hour distributions.
- Ensure that you have the necessary permissions to access your Google Calendar data.
- The project includes a
.gitignore
file to exclude sensitive files likecredentials.json
and any generated data files.
This project is licensed under the MIT License. See the LICENSE file for more details.