GLOBAL LAYOFFS
DATA CLEANING & EXPLORATORY DATA ANALYSIS

OBJECTIVE

The aim of this project is to clean and standardize a dataset containing layoff information from various companies. The project involves removing duplicates, handling null values, formatting data, and performing other data cleansing tasks to ensure data consistency and readiness for analysis. The project also aims to conduct an Exploratory Data Analysis (EDA) on global layoff data to uncover trends, patterns, and insights such as the largest layoffs by companies, locations, industries, and countries over time. The goal is to understand the magnitude and distribution of layoffs across different factors.

Check Out Some of My Works

Key Technologies/Tools

SQL: Data cleaning and transformation using MySQL.
CTE (Common Table Expressions): For identifying and deleting duplicates.
Window Functions: Usage of ROW_NUMBER() to handle duplicates and for subqueries and complex query chains.
String Functions: TRIM() to clean up textual data.
Date Functions: STR_TO_DATE() to reformat and standardize date values.
Aggregate Functions: SUM(), MAX(), MIN().
Analytical SQL Concepts: Grouping, ranking, rolling totals, and temporal data analysis are key components of this project.

Key Features

Creation of Staging Table: A copy of the original dataset is created in a staging table to preserve raw data during cleaning operations.
Duplicate Removal: Identification and deletion of duplicate records using ROW_NUMBER() with PARTITION BY. Checked for specific duplicates, such as for companies "Oda" and "Casper."
Data Formatting and Standardization: Trimming whitespace from the company names using TRIM(). Updating incorrect values in the industry column (e.g., replacing a URL with 'Newspaper'). Formatting the date column and altering its datatype to DATE.
Null and Blank Values Handling: Identification of null or blank values in total_laid_off and percentage_laid_off columns. Deletion of rows with both columns as blank or null.
Data Type Corrections: Modified columns like date and funds_raised to appropriate data types.
Data Quality Checks: Performed checks on industry, location, stage, country, and other columns to identify inconsistencies and rectify them.
Ranking by Layoff Magnitude: Largest Layoffs by Company: Queries are used to identify which companies had the largest single-day layoffs and which companies had the highest total layoffs. Layoffs by Location and Country: Grouping by location and country to find areas most impacted by layoffs. Layoffs by Industry: Understanding the layoffs distributed by industry, revealing which sectors are most affected. Layoffs by Funding Stage: Grouping and ranking layoffs by funding stage (e.g., Series A, B, etc.).
Year-over-Year Layoff Trends: Layoff Trends by Year: Year-over-year trends are identified, showing how layoffs have evolved annually. Top 3 Companies by Layoffs per Year: Using a combination of CTEs and DENSE_RANK(), the project identifies the top three companies with the most layoffs each year.
Rolling Layoff Totals: Rolling Total Layoffs Per Month: A rolling total of layoffs per month is calculated, providing insight into how layoffs accumulate over time. CTE-Based Analysis: A CTE is used to generate rolling totals, which can be queried for more flexible insights.

Results

The cleaned dataset is consistent, free from duplicates, and has properly formatted data, making it ready for further analysis or reporting. This ensures that any insights derived from the data are based on accurate and reliable information, improving decision-making around company layoffs.
Key Insights on Layoffs: The EDA uncovered valuable insights, such as companies and industries most impacted by layoffs, the locations with the highest layoffs, and trends in layoffs over time.
Identification of Outliers: Outliers, such as companies laying off 100% of their employees, were identified, highlighting sectors under stress during specific periods.
Temporal Analysis: Rolling totals of layoffs provided a view of how layoffs accumulate and when spikes occur, allowing for better understanding of economic impacts.

* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: Arial, sans-serif; } .container { display: flex; justify-content: space-between; padding: 50px; } .gallery-left { flex: 1; display: flex; justify-content: center; align-items: center; } .gallery-grid { display: grid; grid-template-columns: repeat(4, 266px); grid-gap: 30px; } .gallery-item img { width: 100%; height: auto; border-radius: 5px; } .gallery-right { flex: 1; padding-left: 50px; } .gallery-right h2 { font-size: 2.5rem; color: #2a3950; } .gallery-right h3 { font-size: 1.5rem; margin-top: 10px; color: #3a485f; } .gallery-right p { margin-top: 20px; font-size: 1rem; color: #6c757d; line-height: 1.6; } .button { display: inline-block; margin-top: 20px; padding: 10px 20px; background-color: #23395b; color: white; text-decoration: none; border-radius: 5px; font-weight: bold; text-transform: uppercase; } .button:hover { background-color: #1e324d; } /* Image hover effects */ .gallery-item img { transition: transform 0.3s ease, box-shadow 0.3s ease; border-radius: 10px; } /* Zoom in and shadow effect on hover */ .gallery-item img:hover { transform: scale(1.1); /* Zoom in */ box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5); /* Add shadow */ } /* Image popup styles */ .image-popup { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(0, 0, 0, 0.8); display: flex; justify-content: center; align-items: center; z-index: 1000; } .popup-content img { max-width: 80%; max-height: 80%; border-radius: 10px; } .gallery-item { position: relative; display: inline-block; } .gallery-item img { display: block; width: 100%; height: auto; } .gallery-item .overlay { position: absolute; bottom: 0; left: 0; right: 0; background-color: rgba(0, 0, 0, 0.7); /* Dark background with some transparency */ overflow: hidden; width: 100%; height: 100%; opacity: 0; /* Initially invisible */ transition: opacity 0.5s ease; display: flex; justify-content: center; align-items: center; color: white; /* Text color */ font-size: 1.5rem; /* Adjust font size as needed */ } .gallery-item:hover .overlay { opacity: 1; /* Fully visible on hover */ } /* Image popup styles */ .image-popup { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(0, 0, 0, 0.8); display: flex; justify-content: center; align-items: center; z-index: 1000; } .popup-content img { max-width: 50%; max-height: 50%; border-radius: 10px; display: block; /* Ensures the image remains a block-level element */ margin: auto; } .close { position: absolute; top: 50px; right: 100px; font-size: 3rem; color: white; cursor: pointer; }