Загрузка...

LeetCode 511- Game Play Analysis 1 (Python and SQL) [EASY]

🧠 Don’t miss out! Get FREE access to my Skool community — packed with resources, tools, and support to help you with Data, Machine Learning, and AI Automations! 📈 https://www.skool.com/data-and-ai-automations-4579

In this video, we break down LeetCode 511 - Game Play Analysis 1 using both SQL and Python (Pandas). Learn how to analyze player login data, solve time-based queries, and understand how to approach real-world database problems—perfect for beginners!

Leetcode 511- Game Play Analysis 1: https://leetcode.com/problems/game-play-analysis-i/description/
🚀 Hire me for Data Work: https://ryanandmattdatascience.com/data-freelancing/
👨‍💻 Mentorships: https://ryanandmattdatascience.com/mentorship/
📧 Email: ryannolandata@gmail.com
🌐 Website & Blog: https://ryanandmattdatascience.com/
🖥️ Discord: https://discord.com/invite/F7dxbvHUhg
📚 *Practice SQL & Python Interview Questions: https://stratascratch.com/?via=ryan
📖 *SQL and Python Courses: https://datacamp.pxf.io/XYD7Qg

🍿 WATCH NEXT
LeetCode Playlist: https://www.youtube.com/playlist?list=PLcQVY5V2UY4J_wlwSXiEuf2KrEBan0Ysv
LeetCode 183: https://www.youtube.com/watch?v=M0SK08bDHPU&feature=youtu.be
LeetCode 180: https://www.youtube.com/watch?v=ATj_crJULks&ab_channel=RyanNolanData
LeetCode 175: https://www.youtube.com/watch?v=l4NzniB-rj4&feature=youtu.be

In this video, I solve LeetCode 511 Game Play Analysis I in both SQL and Python Pandas, taking you line by line through each solution. This easy-level SQL problem asks you to find the first login date for each player from an activity table. I break down the problem step by step, showing you how to use window functions like RANK() with PARTITION BY in SQL, and how to replicate that logic in Python Pandas using groupby and rank methods.

For the SQL solution, I walk through creating a CTE that ranks login dates for each player using PARTITION BY, then filtering for the first login by selecting where the rank equals one. I also show you how to rename columns with AS to match the expected output format. On the Python Pandas side, I demonstrate how to use groupby to partition data by player_id, rank the event_date column with method='min', and filter for the first login before renaming columns with the rename function.

Whether you're preparing for data analyst interviews, practicing SQL window functions, or learning Pandas data manipulation techniques, this tutorial covers essential concepts like partitioning, ranking, and column renaming. By the end, you'll understand how to solve similar first-occurrence problems in both SQL and Python Pandas. If you found this helpful, subscribe for more LeetCode SQL and Python tutorials every week as I continue building my data skills!

TIMESTAMPS
00:00 Problem Introduction & Overview
00:47 SQL Solution - Building the SELECT Statement
01:42 Adding Rank with Partition By
02:45 Creating the CTE
03:37 Final Query & Testing Solution
04:29 Python Pandas Solution
05:22 Renaming Columns & Return Statement
06:58 Code Explanation & Wrap Up

OTHER SOCIALS:
Ryan’s LinkedIn: https://www.linkedin.com/in/ryan-p-nolan/
Matt’s LinkedIn: https://www.linkedin.com/in/matt-payne-ceo/
Twitter/X: https://x.com/RyanMattDS

Who is Ryan
Ryan is a Data Scientist at a fintech company, where he focuses on fraud prevention in underwriting and risk. Before that, he worked as a Data Analyst at a tax software company. He holds a degree in Electrical Engineering from UCF.

Who is Matt
Matt is the founder of Width.ai, an AI and Machine Learning agency. Before starting his own company, he was a Machine Learning Engineer at Capital One.

*This is an affiliate program. We receive a small portion of the final sale at no extra cost to you.

Видео LeetCode 511- Game Play Analysis 1 (Python and SQL) [EASY] канала Ryan & Matt Data Science
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять