LeetCode 30 Days of Pandas is LeetCode’s free study plan for pandas interview questions: 30 core problems in six sections (Data Filtering, String Methods, Data Manipulation, Statistics, Data Aggregation and Data Integration), plus three bonus questions, for 33 in total. As of October 2026 the mix is 25 Easy and 8 Medium with no Hard, and five of the problems are marked Premium. One problem a day takes a month; if you already know SQL, three a day gets you through in about ten days. Sixteen of the 33 problems also appear in LeetCode SQL 50, which makes the two plans a natural pair for data roles.
Below: the plan’s structure, a day-by-day map with the pandas concept each problem teaches, the traps that fail answers that look right, how to combine it with SQL 50, and what else data analyst, data scientist and data engineer interviews expect.
What is in 30 Days of Pandas
On the study plan page, LeetCode says the plan covers the essential topics often asked in pandas interviews, and that you should know basic Python (syntax, data types, conditionals, loops, functions, lists) before starting. The plan defaults to the Pandas language, and finishing it earns a badge. Here is how the 33 problems break down, as of October 2026:
| Section | Problems | Difficulty | Core pandas skills |
|---|---|---|---|
| Data Filtering | 4 | 4 Easy | Boolean masks, isin, column selection |
| String Methods | 5 | 5 Easy | The .str accessor, regex matching |
| Data Manipulation | 6 | 4 Medium, 2 Easy | Nth-highest values, ranking, in-place deletes, melt |
| Statistics | 3 | 2 Easy (both Premium), 1 Medium | Counting, percentages, binning |
| Data Aggregation | 7 | 7 Easy | groupby, agg, nunique, value_counts |
| Data Integration | 5 | 4 Easy, 1 Medium | merge: left, cross, self and anti-joins |
| Bonus (“Strengthen Your Learning”) | 3 | 1 Easy, 2 Medium, all Premium | Extra practice after String Methods, Statistics and Data Integration |
The 28 free problems all accept MySQL, MS SQL Server, PostgreSQL and Oracle as well as Pandas, so you can check a pandas answer against a SQL one. If pandas is brand new to you, LeetCode’s separate Introduction to Pandas plan is a gentler start: 15 Easy problems on creating DataFrames, selecting data, cleaning (duplicates, missing values, renaming, type changes), reshaping (concat, pivot, melt) and method chaining. LeetCode describes it as preparation for 30 Days of Pandas.
The day-by-day map
This follows LeetCode’s order, one core problem per day. The last column marks the 16 problems that also appear in SQL 50.
| Day | Problem | Level | What it teaches | In SQL 50 |
|---|---|---|---|---|
| 1 | Big Countries | Easy | Boolean masks with | and parentheses; selecting columns | Yes |
| 2 | Recyclable and Low Fat Products | Easy | Combining conditions with & | Yes |
| 3 | Customers Who Never Order | Easy | Anti-join with ~isin() | No |
| 4 | Article Views I | Easy | Comparing two columns, drop_duplicates, sorting, renaming | Yes |
| 5 | Invalid Tweets | Easy | .str.len() | Yes |
| 6 | Calculate Special Bonus | Easy | Conditional column with np.where; .str.startswith | No |
| 7 | Fix Names in a Table | Easy | .str.capitalize() | Yes |
| 8 | Find Users With Valid E-Mails | Easy | .str.match with an anchored regex | Yes |
| 9 | Patients With a Condition | Easy | .str.contains with a regex for a code at the start of any word | Yes |
| 10 | Nth Highest Salary | Medium | Distinct values, sorting, returning null when there are fewer than N | No |
| 11 | Second Highest Salary | Medium | Same pattern; LeetCode asks for None in Pandas when there is no answer | Yes |
| 12 | Department Highest Salary | Medium | merge, then groupby().transform('max') | No |
| 13 | Rank Scores | Medium | rank(method='dense', ascending=False) | No |
| 14 | Delete Duplicate Emails | Easy | Modifying the DataFrame in place, keeping the smallest id | Yes |
| 15 | Rearrange Products Table | Easy | melt from wide to long, then dropna | No |
| 16 | The Number of Rich Customers | Easy (Premium) | Statistics section; swap in a free problem if needed (see below) | No |
| 17 | Immediate Food Delivery I | Easy (Premium) | Statistics section; swap in a free problem if needed | No |
| 18 | Count Salary Categories | Medium | Binning into three categories and keeping categories with zero accounts | Yes |
| 19 | Find Total Time Spent by Each Employee | Easy | Derived column, groupby on two keys, sum | No |
| 20 | Game Play Analysis I | Easy | groupby().min() on dates | No |
| 21 | Number of Unique Subjects Taught by Each Teacher | Easy | nunique | Yes |
| 22 | Classes With at Least 5 Students | Easy | Group counts, then a HAVING-style filter | Yes |
| 23 | Customer Placing the Largest Number of Orders | Easy | value_counts; the follow-up asks about ties | No |
| 24 | Group Sold Products By The Date | Easy | agg with nunique plus sorted, joined names | Yes |
| 25 | Daily Leads and Partners | Easy | Two keys, two distinct counts | No |
| 26 | Actors and Directors Who Cooperated At Least Three Times | Easy | Group by a pair, filter on size | No |
| 27 | Replace Employee ID With The Unique Identifier | Easy | Left merge; missing matches become null | Yes |
| 28 | Students and Examinations | Easy | merge(how='cross'), counts, fillna(0), two-key sort | Yes |
| 29 | Managers with at Least 5 Direct Reports | Medium | Self-join: count reports, then map back to names | Yes |
| 30 | Sales Person | Easy | Three-table merge and an anti-join | No |
The three bonus problems (Count Occurrences in Text after String Methods, Ads Performance after Statistics, and Accepted Candidates From the Interviews after Data Integration) are all Premium. We could not open their statements without a subscription, so we do not describe them here.
The pandas concepts that matter most
Thirty problems sound like a lot, but they drill about six ideas. If you can write each of these from memory, most problems become a few lines.
Filtering with boolean masks
Days 1 to 4. Conditions combine with &, | and ~, never and or or, and each condition needs parentheses: world.loc[(world['area'] >= 3000000) | (world['population'] >= 25000000), ['name', 'population', 'area']]. Anti-joins (“customers who never order”) are ~customers['id'].isin(orders['customerId']).
String methods and regex
Days 5 to 9. The .str accessor gives you len, startswith, capitalize, match and contains. The email problem is the one to slow down on: the prefix must start with a letter, may contain letters, digits, underscore, period and dash, and the domain must be exactly @leetcode.com, so anchor the pattern and escape the dots.
Ranking and nth-highest values
Days 10 to 13. Drop duplicate salaries before sorting, handle “fewer than N values” explicitly, and know rank(method='dense'), which gives tied scores the same rank with no gaps, exactly what Rank Scores asks for.
Reshaping and in-place edits
Days 14 and 15. Delete Duplicate Emails tells Pandas users to modify the table in place, so sort by id and call drop_duplicates(subset='email', keep='first', inplace=True) rather than returning a new DataFrame. Rearrange Products Table is a textbook melt followed by dropna.
Group-by and aggregation
Days 18 to 26. The workhorse pattern is df.groupby(keys).agg(new_col=('col', 'func')).reset_index(). Named aggregation gives you the output column names the problem asks for in one step.
Merges
Days 27 to 30. Left merges keep unmatched rows as null, how='cross' builds every student and subject pair before counting, a self-merge links employees to managers, and Sales Person needs a three-table merge followed by an anti-join.
Traps that fail correct-looking answers
- Wrong output columns. The checker compares column names. Rename to exactly what the expected output shows.
- Returning an empty DataFrame when the problem wants null. Second Highest Salary says to return None in Pandas when there is no second salary; build a one-row DataFrame instead of returning nothing.
- Returning instead of mutating. Delete Duplicate Emails checks the original table after your code runs.
- Dropping zero-count groups. Count Salary Categories must list all three categories even when one is empty, and Students and Examinations needs pairs with zero exams. Build the full set of keys first, then fill in counts.
- Missing keys in
groupby. By default,groupbydrops rows whose key is missing, which silently changes counts. - Rounding differences. pandas and NumPy round exact halves to the nearest even number, while MySQL’s
ROUNDrounds exact-value (DECIMAL) halves away from zero, so a percentage can differ in the last digit from your SQL answer. - Using
applyfor everything. It works on these small tables but reads badly in an interview. Prefer vectorized operations and say why.
How it pairs with SQL 50
Sixteen problems sit in both plans, so the fastest route for a data role is to treat them as one set. Our LeetCode SQL 50 guide covers the SQL side; this table translates the core moves.
| SQL | pandas |
|---|---|
WHERE | Boolean mask or .query() |
SELECT DISTINCT | drop_duplicates() |
JOIN / LEFT JOIN | merge(how='inner') / merge(how='left') |
LEFT JOIN … WHERE b.id IS NULL | ~isin() or merge(indicator=True) |
CROSS JOIN | merge(how='cross') |
GROUP BY … HAVING | groupby().agg(), then filter |
COUNT(DISTINCT x) | nunique() |
DENSE_RANK() OVER (…) | rank(method='dense') |
CASE WHEN | np.where or np.select |
UNION ALL | pd.concat |
ORDER BY | sort_values() |
A combined order that works: do SQL 50 first using the two-week plan in that guide, then run 30 Days of Pandas in about ten days. For the 16 shared problems, rewrite your SQL solution in pandas and compare. The 14 pandas-only core problems (Customers Who Never Order, Rank Scores, Rearrange Products Table, the salary ranking problems and the group-by sets) get your fresh attention. If your interviews are SQL-first, stop after SQL 50 plus the pandas-only problems.
Is it enough for data-role interviews?
It covers the core of a pandas manipulation round: filter, join, group and reshape a few small tables. It does not cover everything data interviews ask.
| Role | How much the plan covers | What to add |
|---|---|---|
| Data analyst | Most of the pandas you need | SQL 50, pivot_table, dates and time series, explaining results to non-technical stakeholders |
| Data scientist | The data-wrangling part | Statistics, experiments and A/B testing, modeling questions, product sense |
| Data engineer | Basic transformations | Advanced SQL, data modeling, pipeline and system design, performance at scale |
| ML engineer | Feature-prep basics | Algorithms and data structures, ML theory, ML system design |
Topics the plan skips that are worth an hour each: missing-data handling beyond fillna, pivot_table, resample and rolling for time series, and window-style operations with groupby().cumsum() and shift. Role-specific prep is on our data science interview help page and in the guides for data analysts and data scientists.
How to work each problem so it transfers
- Read the expected output first. Column names, ordering and null handling decide most failures.
- Write the SQL in your head, then the pandas. Thinking in joins and groups first keeps the pandas code short.
- Explain it out loud. In an interview you will be asked why
mergebeat a loop, or whydenseranking. Practice saying it in two sentences. - Re-solve the Mediums from a blank editor a few days later, without looking at your old code.
- Practice under interview conditions. A free AI mock interview in CoPilot Interview builds coding and technical questions from your résumé and the job description, lets you pick Python as your coding language, and scores each answer out of 10 with what to fix and a model answer. Coding questions never auto-submit, so you can think in silence. The browser version also includes SQL and data science tracks.
For general Python and SQL round prep, see Python interview help and SQL interview help.
Explain your pandas solutions out loud
Paste a data role’s job description and your résumé, choose Python, and answer an AI interviewer’s technical and coding questions. Each answer gets a score out of 10, what to fix and a model answer. Free for 15 minutes a day, no credit card.
Try a free AI mock interviewFAQ
Is LeetCode 30 Days of Pandas free?
The study plan itself is free, but as of October 2026 LeetCode marks five of its 33 problems as Premium: two in the Statistics section and all three bonus questions. The other 28 are free, and free SQL 50 problems can stand in for the Premium ones.
How many problems are in 30 Days of Pandas?
There are 30 core problems in six sections plus three bonus questions, 33 in total. As of October 2026 the mix is 25 Easy and 8 Medium, with no Hard problems.
How long does 30 Days of Pandas take?
One problem a day takes a month. If you already know SQL or basic pandas, three problems a day gets you through in about ten days, with a review day for the Medium problems.
Should I do SQL 50 or 30 Days of Pandas first?
For most data roles, start with SQL 50, because SQL rounds are more common and 16 of the pandas problems repeat SQL 50 problems. Then do 30 Days of Pandas, rewriting your SQL answers in pandas for the shared problems.
What is the difference between Introduction to Pandas and 30 Days of Pandas?
Introduction to Pandas is a 15-problem beginner plan on creating, inspecting, cleaning and reshaping DataFrames. 30 Days of Pandas is the interview-style plan with filtering, string, ranking, aggregation and merge problems. LeetCode presents the first as preparation for the second.
Is 30 Days of Pandas enough for a data science interview?
It covers the data-manipulation part well, but data science loops usually add statistics, experiment design, modeling and product questions. Treat it as one piece of your prep, alongside SQL practice and mock interviews.