task_id stringlengths 10 10 | category stringclasses 6
values | prompt stringlengths 34 208 | input_data stringclasses 6
values | expected_output stringlengths 133 4.57k |
|---|---|---|---|---|
pandas-000 | cleaning | Drop rows where 'score' is missing. Keep all columns and reset the index. | {"df": "{\"data\": {\"columns\": [\"id\", \"name\", \"score\", \"dept\", \"joined\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], \"data\": [[1, \" Ana \", 88.0, \"eng\", \"2024-01-05\"], [2, \"BEN\", null, \"eng\", \"2024-02-11\"], [3, \"cleo\", 72.5, \"ops\", \"not a date\"], [4, null, 91.0, \"ops\", \"2024-03-02\"],... | {"data": {"columns": ["id", "name", "score", "dept", "joined"], "index": [0, 1, 2, 3, 4, 5, 6], "data": [[1, " Ana ", 88.0, "eng", "2024-01-05"], [3, "cleo", 72.5, "ops", "not a date"], [4, null, 91.0, "ops", "2024-03-02"], [6, "eve ", 64.0, "sales", "2024-05-30"], [7, "Fay", 79.5, "sales", "2024-06-08"], [8, "gil", ... |
pandas-001 | cleaning | Remove exact duplicate rows, keeping the first occurrence. Reset the index. | {"df": "{\"data\": {\"columns\": [\"id\", \"name\", \"score\", \"dept\", \"joined\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], \"data\": [[1, \" Ana \", 88.0, \"eng\", \"2024-01-05\"], [2, \"BEN\", null, \"eng\", \"2024-02-11\"], [3, \"cleo\", 72.5, \"ops\", \"not a date\"], [4, null, 91.0, \"ops\", \"2024-03-02\"],... | {"data": {"columns": ["id", "name", "score", "dept", "joined"], "index": [0, 1, 2, 3, 4, 5, 6, 7], "data": [[1, " Ana ", 88.0, "eng", "2024-01-05"], [2, "BEN", null, "eng", "2024-02-11"], [3, "cleo", 72.5, "ops", "not a date"], [4, null, 91.0, "ops", "2024-03-02"], [5, "Dan", null, "eng", "2024-04-19"], [6, "eve ", 6... |
pandas-002 | cleaning | Strip leading/trailing whitespace from 'name' and lowercase it. Leave missing names missing. | {"df": "{\"data\": {\"columns\": [\"id\", \"name\", \"score\", \"dept\", \"joined\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], \"data\": [[1, \" Ana \", 88.0, \"eng\", \"2024-01-05\"], [2, \"BEN\", null, \"eng\", \"2024-02-11\"], [3, \"cleo\", 72.5, \"ops\", \"not a date\"], [4, null, 91.0, \"ops\", \"2024-03-02\"],... | {"data": {"columns": ["id", "name", "score", "dept", "joined"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "data": [[1, "ana", 88.0, "eng", "2024-01-05"], [2, "ben", null, "eng", "2024-02-11"], [3, "cleo", 72.5, "ops", "not a date"], [4, null, 91.0, "ops", "2024-03-02"], [5, "dan", null, "eng", "2024-04-19"], [6, "eve", ... |
pandas-003 | cleaning | Fill missing 'score' values with the mean score of that row's 'dept', rounded to 2 decimals. | {"df": "{\"data\": {\"columns\": [\"id\", \"name\", \"score\", \"dept\", \"joined\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], \"data\": [[1, \" Ana \", 88.0, \"eng\", \"2024-01-05\"], [2, \"BEN\", null, \"eng\", \"2024-02-11\"], [3, \"cleo\", 72.5, \"ops\", \"not a date\"], [4, null, 91.0, \"ops\", \"2024-03-02\"],... | {"data": {"columns": ["id", "name", "score", "dept", "joined"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "data": [[1, " Ana ", 88.0, "eng", "2024-01-05"], [2, "BEN", 88.0, "eng", "2024-02-11"], [3, "cleo", 72.5, "ops", "not a date"], [4, null, 91.0, "ops", "2024-03-02"], [5, "Dan", 88.0, "eng", "2024-04-19"], [6, "eve... |
pandas-004 | cleaning | Parse 'joined' into datetime, turning unparseable values into NaT. Keep the column name. | {"df": "{\"data\": {\"columns\": [\"id\", \"name\", \"score\", \"dept\", \"joined\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], \"data\": [[1, \" Ana \", 88.0, \"eng\", \"2024-01-05\"], [2, \"BEN\", null, \"eng\", \"2024-02-11\"], [3, \"cleo\", 72.5, \"ops\", \"not a date\"], [4, null, 91.0, \"ops\", \"2024-03-02\"],... | {"data": {"columns": ["id", "name", "score", "dept", "joined"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "data": [[1, " Ana ", 88.0, "eng", "2024-01-05T00:00:00.000000000"], [2, "BEN", null, "eng", "2024-02-11T00:00:00.000000000"], [3, "cleo", 72.5, "ops", null], [4, null, 91.0, "ops", "2024-03-02T00:00:00.000000000"]... |
pandas-005 | cleaning | Keep only rows whose 'score' is within 1.5 standard deviations of the mean score (ignore missing scores when computing them, and drop rows with a missing score). Reset the index. | {"df": "{\"data\": {\"columns\": [\"id\", \"name\", \"score\", \"dept\", \"joined\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], \"data\": [[1, \" Ana \", 88.0, \"eng\", \"2024-01-05\"], [2, \"BEN\", null, \"eng\", \"2024-02-11\"], [3, \"cleo\", 72.5, \"ops\", \"not a date\"], [4, null, 91.0, \"ops\", \"2024-03-02\"],... | {"data": {"columns": ["id", "name", "score", "dept", "joined"], "index": [0, 1, 2, 3, 4, 5, 6], "data": [[1, " Ana ", 88.0, "eng", "2024-01-05"], [3, "cleo", 72.5, "ops", "not a date"], [4, null, 91.0, "ops", "2024-03-02"], [6, "eve ", 64.0, "sales", "2024-05-30"], [7, "Fay", 79.5, "sales", "2024-06-08"], [8, "gil", ... |
pandas-006 | cleaning | Drop the 'joined' column entirely. | {"df": "{\"data\": {\"columns\": [\"id\", \"name\", \"score\", \"dept\", \"joined\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], \"data\": [[1, \" Ana \", 88.0, \"eng\", \"2024-01-05\"], [2, \"BEN\", null, \"eng\", \"2024-02-11\"], [3, \"cleo\", 72.5, \"ops\", \"not a date\"], [4, null, 91.0, \"ops\", \"2024-03-02\"],... | {"data": {"columns": ["id", "name", "score", "dept"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "data": [[1, " Ana ", 88.0, "eng"], [2, "BEN", null, "eng"], [3, "cleo", 72.5, "ops"], [4, null, 91.0, "ops"], [5, "Dan", null, "eng"], [6, "eve ", 64.0, "sales"], [7, "Fay", 79.5, "sales"], [8, "gil", 100.0, "ops"], [5, "D... |
pandas-007 | cleaning | Replace missing 'name' values with the string 'unknown'. | {"df": "{\"data\": {\"columns\": [\"id\", \"name\", \"score\", \"dept\", \"joined\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], \"data\": [[1, \" Ana \", 88.0, \"eng\", \"2024-01-05\"], [2, \"BEN\", null, \"eng\", \"2024-02-11\"], [3, \"cleo\", 72.5, \"ops\", \"not a date\"], [4, null, 91.0, \"ops\", \"2024-03-02\"],... | {"data": {"columns": ["id", "name", "score", "dept", "joined"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "data": [[1, " Ana ", 88.0, "eng", "2024-01-05"], [2, "BEN", null, "eng", "2024-02-11"], [3, "cleo", 72.5, "ops", "not a date"], [4, "unknown", 91.0, "ops", "2024-03-02"], [5, "Dan", null, "eng", "2024-04-19"], [6,... |
pandas-008 | transformation | Add a column 'revenue' equal to units * unit_price * (1 - discount), rounded to 2 decimals. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["order_id", "region", "rep", "units", "unit_price", "discount", "revenue"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55... |
pandas-009 | transformation | Add a column 'size' that is 'small' when units < 10, 'medium' when units < 25, and 'large' otherwise. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["order_id", "region", "rep", "units", "unit_price", "discount", "size"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 5... |
pandas-010 | transformation | Return only the columns 'order_id', 'region' and 'units', in that order. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["order_id", "region", "units"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59], "data": [[1000, "north", ... |
pandas-011 | transformation | Rename 'unit_price' to 'price' and 'rep' to 'salesperson'. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["order_id", "region", "salesperson", "units", "price", "discount"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57... |
pandas-012 | transformation | Sort by 'units' descending, then by 'order_id' ascending. Reset the index. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["order_id", "region", "rep", "units", "unit_price", "discount"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 5... |
pandas-013 | transformation | Keep only rows where region is 'north' or 'south' AND units is at least 20. Reset the index. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["order_id", "region", "rep", "units", "unit_price", "discount"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "data": [[1000, "north", "ana", 35, 46.0, 0.05], [1004, "north", "eve", 37, 7.98, 0.0], [1006, "north", "cleo", 39, 93.74, 0.2], [1010, "south", "dan", 39, 33.05, 0.15], [1022, "north", "dan",... |
pandas-014 | transformation | Add a column 'rank_in_region' giving the dense rank of 'units' within each region, highest units = rank 1. Make it an int64 column. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["order_id", "region", "rep", "units", "unit_price", "discount", "rank_in_region"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,... |
pandas-015 | transformation | Uppercase the 'region' column and add a column 'initial' holding the first character of 'rep'. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["order_id", "region", "rep", "units", "unit_price", "discount", "initial"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55... |
pandas-016 | transformation | Return the 10 rows with the largest 'units', ordered by units descending. Reset the index. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["order_id", "region", "rep", "units", "unit_price", "discount"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "data": [[1006, "north", "cleo", 39, 93.74, 0.2], [1010, "south", "dan", 39, 33.05, 0.15], [1047, "west", "cleo", 39, 61.41, 0.15], [1004, "north", "eve", 37, 7.98, 0.0], [1026, "north", "eve"... |
pandas-017 | transformation | Cast 'units' to float64 and 'order_id' to string. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["order_id", "region", "rep", "units", "unit_price", "discount"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 5... |
pandas-018 | joins | Inner join employees (df1) with departments (df2) on 'dept_id'. | {"df1": "{\"data\": {\"columns\": [\"emp_id\", \"name\", \"dept_id\", \"salary\"], \"index\": [0, 1, 2, 3, 4, 5, 6], \"data\": [[1, \"ana\", 10, 95000], [2, \"ben\", 10, 72000], [3, \"cleo\", 20, 88000], [4, \"dan\", 30, 61000], [5, \"eve\", 20, 120000], [6, \"fay\", 40, 55000], [7, \"gil\", 10, 78000]]}, \"dtypes\": {... | {"data": {"columns": ["emp_id", "name", "dept_id", "salary", "dept_name", "floor"], "index": [0, 1, 2, 3, 4, 5], "data": [[1, "ana", 10, 95000, "engineering", 3], [2, "ben", 10, 72000, "engineering", 3], [3, "cleo", 20, 88000, "operations", 1], [4, "dan", 30, 61000, "support", 2], [5, "eve", 20, 120000, "operations", 1... |
pandas-019 | joins | Left join employees (df1) with departments (df2) on 'dept_id', keeping every employee. | {"df1": "{\"data\": {\"columns\": [\"emp_id\", \"name\", \"dept_id\", \"salary\"], \"index\": [0, 1, 2, 3, 4, 5, 6], \"data\": [[1, \"ana\", 10, 95000], [2, \"ben\", 10, 72000], [3, \"cleo\", 20, 88000], [4, \"dan\", 30, 61000], [5, \"eve\", 20, 120000], [6, \"fay\", 40, 55000], [7, \"gil\", 10, 78000]]}, \"dtypes\": {... | {"data": {"columns": ["emp_id", "name", "dept_id", "salary", "dept_name", "floor"], "index": [0, 1, 2, 3, 4, 5, 6], "data": [[1, "ana", 10, 95000, "engineering", 3.0], [2, "ben", 10, 72000, "engineering", 3.0], [3, "cleo", 20, 88000, "operations", 1.0], [4, "dan", 30, 61000, "support", 2.0], [5, "eve", 20, 120000, "ope... |
pandas-020 | joins | Full outer join employees (df1) and departments (df2) on 'dept_id'. Sort the result by 'dept_id' then 'emp_id' and reset the index. | {"df1": "{\"data\": {\"columns\": [\"emp_id\", \"name\", \"dept_id\", \"salary\"], \"index\": [0, 1, 2, 3, 4, 5, 6], \"data\": [[1, \"ana\", 10, 95000], [2, \"ben\", 10, 72000], [3, \"cleo\", 20, 88000], [4, \"dan\", 30, 61000], [5, \"eve\", 20, 120000], [6, \"fay\", 40, 55000], [7, \"gil\", 10, 78000]]}, \"dtypes\": {... | {"data": {"columns": ["emp_id", "name", "dept_id", "salary", "dept_name", "floor"], "index": [0, 1, 2, 3, 4, 5, 6, 7], "data": [[1.0, "ana", 10, 95000.0, "engineering", 3.0], [2.0, "ben", 10, 72000.0, "engineering", 3.0], [7.0, "gil", 10, 78000.0, "engineering", 3.0], [3.0, "cleo", 20, 88000.0, "operations", 1.0], [5.0... |
pandas-021 | joins | Return only the employees (df1) whose 'dept_id' does NOT appear in departments (df2). Keep df1's columns and reset the index. | {"df1": "{\"data\": {\"columns\": [\"emp_id\", \"name\", \"dept_id\", \"salary\"], \"index\": [0, 1, 2, 3, 4, 5, 6], \"data\": [[1, \"ana\", 10, 95000], [2, \"ben\", 10, 72000], [3, \"cleo\", 20, 88000], [4, \"dan\", 30, 61000], [5, \"eve\", 20, 120000], [6, \"fay\", 40, 55000], [7, \"gil\", 10, 78000]]}, \"dtypes\": {... | {"data": {"columns": ["emp_id", "name", "dept_id", "salary"], "index": [0], "data": [[6, "fay", 40, 55000]]}, "dtypes": {"emp_id": "int64", "name": "str", "dept_id": "int64", "salary": "int64"}} |
pandas-022 | joins | Return only the employees (df1) whose 'dept_id' DOES appear in departments (df2). Keep df1's columns and reset the index. | {"df1": "{\"data\": {\"columns\": [\"emp_id\", \"name\", \"dept_id\", \"salary\"], \"index\": [0, 1, 2, 3, 4, 5, 6], \"data\": [[1, \"ana\", 10, 95000], [2, \"ben\", 10, 72000], [3, \"cleo\", 20, 88000], [4, \"dan\", 30, 61000], [5, \"eve\", 20, 120000], [6, \"fay\", 40, 55000], [7, \"gil\", 10, 78000]]}, \"dtypes\": {... | {"data": {"columns": ["emp_id", "name", "dept_id", "salary"], "index": [0, 1, 2, 3, 4, 5], "data": [[1, "ana", 10, 95000], [2, "ben", 10, 72000], [3, "cleo", 20, 88000], [4, "dan", 30, 61000], [5, "eve", 20, 120000], [7, "gil", 10, 78000]]}, "dtypes": {"emp_id": "int64", "name": "str", "dept_id": "int64", "salary": "in... |
pandas-023 | joins | Add a 'dept_name' column to employees (df1) looked up from departments (df2) by 'dept_id'; employees whose department is missing get the string 'unassigned'. Sort by 'salary' descending and reset the index. | {"df1": "{\"data\": {\"columns\": [\"emp_id\", \"name\", \"dept_id\", \"salary\"], \"index\": [0, 1, 2, 3, 4, 5, 6], \"data\": [[1, \"ana\", 10, 95000], [2, \"ben\", 10, 72000], [3, \"cleo\", 20, 88000], [4, \"dan\", 30, 61000], [5, \"eve\", 20, 120000], [6, \"fay\", 40, 55000], [7, \"gil\", 10, 78000]]}, \"dtypes\": {... | {"data": {"columns": ["emp_id", "name", "dept_id", "salary", "dept_name"], "index": [0, 1, 2, 3, 4, 5, 6], "data": [[5, "eve", 20, 120000, "operations"], [1, "ana", 10, 95000, "engineering"], [3, "cleo", 20, 88000, "operations"], [7, "gil", 10, 78000, "engineering"], [2, "ben", 10, 72000, "engineering"], [4, "dan", 30,... |
pandas-024 | aggregation | Group by 'region' and return the total 'units' per region as a column named 'units'. Sort by region ascending, index reset. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["region", "units"], "index": [0, 1, 2, 3], "data": [["east", 347], ["north", 340], ["south", 71], ["west", 321]]}, "dtypes": {"region": "str", "units": "int64"}} |
pandas-025 | aggregation | Group by 'region' and compute mean 'unit_price' rounded to 3 decimals, as a column named 'unit_price'. Sort by region, index reset. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["region", "unit_price"], "index": [0, 1, 2, 3], "data": [["east", 49.34], ["north", 55.364], ["south", 60.055], ["west", 42.946]]}, "dtypes": {"region": "str", "unit_price": "float64"}} |
pandas-026 | aggregation | Group by 'region' and 'rep' and count the rows in each group as a column named 'n'. Sort by region then rep, index reset. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["region", "rep", "n"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], "data": [["east", "ana", 3], ["east", "ben", 3], ["east", "cleo", 5], ["east", "dan", 6], ["east", "eve", 5], ["north", "ana", 4], ["north", "ben", 2], ["north", "cleo", 2], ["north", "dan", 6], ["n... |
pandas-027 | aggregation | For each region return total units as 'total_units' and max unit_price as 'max_price'. Sort by region, index reset. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["region", "total_units", "max_price"], "index": [0, 1, 2, 3], "data": [["east", 347, 93.77], ["north", 340, 93.74], ["south", 71, 80.63], ["west", 321, 89.65]]}, "dtypes": {"region": "str", "total_units": "int64", "max_price": "float64"}} |
pandas-028 | aggregation | Return the single row per region with the highest 'units'. Sort by region, index reset. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["order_id", "region", "rep", "units", "unit_price", "discount"], "index": [0, 1, 2, 3], "data": [[1040, "east", "ana", 33, 93.77, 0.2], [1006, "north", "cleo", 39, 93.74, 0.2], [1010, "south", "dan", 39, 33.05, 0.15], [1047, "west", "cleo", 39, 61.41, 0.15]]}, "dtypes": {"order_id": "int64", "regi... |
pandas-029 | aggregation | Add a column 'region_mean_units' with each region's mean 'units' broadcast back to every row, rounded to 4 decimals. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["order_id", "region", "rep", "units", "unit_price", "discount", "region_mean_units"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, ... |
pandas-030 | aggregation | Count the number of rows per 'action' as a column named 'n'. Sort by action, index reset. | {"df": "{\"data\": {\"columns\": [\"user\", \"action\", \"amount\", \"session\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7], \"data\": [[\"u1\", \"view\", 0.0, 1], [\"u2\", \"view\", 0.0, 1], [\"u1\", \"buy\", 42.5, 1], [\"u3\", \"view\", 0.0, 2], [\"u2\", \"buy\", 19.99, 2], [\"u1\", \"view\", 0.0, 3], [\"u3\", \"buy\", 8.2... | {"data": {"columns": ["action", "n"], "index": [0, 1], "data": [["buy", 3], ["view", 5]]}, "dtypes": {"action": "str", "n": "int64"}} |
pandas-031 | aggregation | For each 'user' compute the total 'amount' as 'spend' and the number of distinct sessions as 'sessions'. Sort by user, index reset. | {"df": "{\"data\": {\"columns\": [\"user\", \"action\", \"amount\", \"session\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7], \"data\": [[\"u1\", \"view\", 0.0, 1], [\"u2\", \"view\", 0.0, 1], [\"u1\", \"buy\", 42.5, 1], [\"u3\", \"view\", 0.0, 2], [\"u2\", \"buy\", 19.99, 2], [\"u1\", \"view\", 0.0, 3], [\"u3\", \"buy\", 8.2... | {"data": {"columns": ["user", "spend", "sessions"], "index": [0, 1, 2], "data": [["u1", 42.5, 2], ["u2", 19.99, 3], ["u3", 8.25, 2]]}, "dtypes": {"user": "str", "spend": "float64", "sessions": "int64"}} |
pandas-032 | timeseries | Set 'ts' as the index and resample to daily frequency, taking the mean 'value' per day rounded to 4 decimals. Return a frame with columns 'ts' and 'value'. | {"df": "{\"data\": {\"columns\": [\"ts\", \"sensor\", \"value\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, ... | {"data": {"columns": ["ts", "value"], "index": [0, 1, 2], "data": [["2025-03-01T00:00:00.000000000", 19.9335], ["2025-03-02T00:00:00.000000000", 20.6863], ["2025-03-03T00:00:00.000000000", 20.7905]]}, "dtypes": {"ts": "datetime64[us]", "value": "float64"}} |
pandas-033 | timeseries | Add a column 'prev_value' holding the previous row's 'value' within each 'sensor' (rows stay in their original order). | {"df": "{\"data\": {\"columns\": [\"ts\", \"sensor\", \"value\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, ... | {"data": {"columns": ["ts", "sensor", "value", "prev_value"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64... |
pandas-034 | timeseries | Add a column 'roll3' with the 3-period rolling mean of 'value' within each 'sensor', rounded to 4 decimals. | {"df": "{\"data\": {\"columns\": [\"ts\", \"sensor\", \"value\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, ... | {"data": {"columns": ["ts", "sensor", "value", "roll3"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,... |
pandas-035 | timeseries | Add integer columns 'hour' and 'day' extracted from 'ts'. Use int32 for both. | {"df": "{\"data\": {\"columns\": [\"ts\", \"sensor\", \"value\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, ... | {"data": {"columns": ["ts", "sensor", "value", "hour", "day"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 6... |
pandas-036 | timeseries | Keep only readings taken on or after 2025-03-02. Reset the index. | {"df": "{\"data\": {\"columns\": [\"ts\", \"sensor\", \"value\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, ... | {"data": {"columns": ["ts", "sensor", "value"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47], "data": [["2025-03-02T00:00:00.000000000", "s1", 25.944], ["2025-03-02T01:00:00... |
pandas-037 | timeseries | Add a column 'delta' equal to 'value' minus the previous 'value' within each 'sensor', rounded to 4 decimals. | {"df": "{\"data\": {\"columns\": [\"ts\", \"sensor\", \"value\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, ... | {"data": {"columns": ["ts", "sensor", "value", "delta"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,... |
pandas-038 | reshaping | Melt the quarterly columns q1..q4 into long format with 'city' as the id, a 'quarter' column and a 'value' column. Sort by city then quarter, index reset. | {"df": "{\"data\": {\"columns\": [\"city\", \"q1\", \"q2\", \"q3\", \"q4\"], \"index\": [0, 1, 2], \"data\": [[\"osaka\", 10, 11, 12, 13], [\"kyoto\", 20, 21, 22, 23], [\"nara\", 30, 31, 32, 33]]}, \"dtypes\": {\"city\": \"str\", \"q1\": \"int64\", \"q2\": \"int64\", \"q3\": \"int64\", \"q4\": \"int64\"}}"} | {"data": {"columns": ["city", "quarter", "value"], "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "data": [["kyoto", "q1", 20], ["kyoto", "q2", 21], ["kyoto", "q3", 22], ["kyoto", "q4", 23], ["nara", "q1", 30], ["nara", "q2", 31], ["nara", "q3", 32], ["nara", "q4", 33], ["osaka", "q1", 10], ["osaka", "q2", 11], ["osa... |
pandas-039 | reshaping | Pivot so that rows are 'region' and columns are 'rep', with values the sum of 'units' and missing combinations filled with 0 as int64. Reset the index so 'region' is a column, and drop the columns index name. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["region", "ana", "ben", "cleo", "dan", "eve"], "index": [0, 1, 2, 3], "data": [["east", 52, 36, 104, 84, 71], ["north", 57, 20, 59, 109, 95], ["south", 10, 1, 0, 39, 21], ["west", 43, 83, 107, 55, 33]]}, "dtypes": {"region": "str", "ana": "int64", "ben": "int64", "cleo": "int64", "dan": "int64", "... |
pandas-040 | reshaping | Produce a cross-tabulation of 'user' (rows) against 'action' (columns) counting rows, with 'user' as a column and no columns index name. | {"df": "{\"data\": {\"columns\": [\"user\", \"action\", \"amount\", \"session\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7], \"data\": [[\"u1\", \"view\", 0.0, 1], [\"u2\", \"view\", 0.0, 1], [\"u1\", \"buy\", 42.5, 1], [\"u3\", \"view\", 0.0, 2], [\"u2\", \"buy\", 19.99, 2], [\"u1\", \"view\", 0.0, 3], [\"u3\", \"buy\", 8.2... | {"data": {"columns": ["user", "buy", "view"], "index": [0, 1, 2], "data": [["u1", 1, 2], ["u2", 1, 2], ["u3", 1, 1]]}, "dtypes": {"user": "str", "buy": "int64", "view": "int64"}} |
pandas-041 | reshaping | Return a frame with one column 'region' listing each distinct region, sorted ascending, index reset. | {"df": "{\"data\": {\"columns\": [\"order_id\", \"region\", \"rep\", \"units\", \"unit_price\", \"discount\"], \"index\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,... | {"data": {"columns": ["region"], "index": [0, 1, 2, 3], "data": [["east"], ["north"], ["south"], ["west"]]}, "dtypes": {"region": "str"}} |
pandas-042 | reshaping | Explode the wide frame's quarter columns into long format and then keep only rows where value is greater than 20. Sort by city then quarter, index reset. | {"df": "{\"data\": {\"columns\": [\"city\", \"q1\", \"q2\", \"q3\", \"q4\"], \"index\": [0, 1, 2], \"data\": [[\"osaka\", 10, 11, 12, 13], [\"kyoto\", 20, 21, 22, 23], [\"nara\", 30, 31, 32, 33]]}, \"dtypes\": {\"city\": \"str\", \"q1\": \"int64\", \"q2\": \"int64\", \"q3\": \"int64\", \"q4\": \"int64\"}}"} | {"data": {"columns": ["city", "quarter", "value"], "index": [0, 1, 2, 3, 4, 5, 6], "data": [["kyoto", "q2", 21], ["kyoto", "q3", 22], ["kyoto", "q4", 23], ["nara", "q1", 30], ["nara", "q2", 31], ["nara", "q3", 32], ["nara", "q4", 33]]}, "dtypes": {"city": "str", "quarter": "str", "value": "int64"}} |
pandas-tasks-v1
Task dataset for a pandas RL / eval environment, in the shape used by the Prime Intellect Environments Hub.
43 pandas DataFrame manipulation tasks across 6 categories. Each task gives the model one or
more input frames and an instruction; the answer is the frame left in df, graded with
pandas.testing.assert_frame_equal against a reference result. Grading is fully
deterministic — no LLM judge, no external API.
| Category | Tasks | Covers |
|---|---|---|
| transformation | 10 | derived columns, conditional binning, projection, renaming, sorting, filtering, window ranks, string ops, top-n, casting |
| cleaning | 8 | missing values, duplicates, whitespace/case, group-wise imputation, date coercion, outliers, column drops |
| aggregation | 8 | sums, means, multi-key counts, named aggregations, per-group top row, broadcast transforms, nunique |
| joins | 6 | inner, left, full outer, anti, semi, lookup-with-default |
| timeseries | 6 | resampling, lags, rolling means, datetime component extraction, date filters, diffs |
| reshaping | 5 | melt, pivot_table, crosstab, distinct values, melt+filter |
Fields
| Field | Description |
|---|---|
task_id |
stable id, e.g. pandas-017 |
category |
one of the six above |
prompt |
the natural-language instruction shown to the model |
input_data |
JSON object mapping frame name (df, or df1/df2 for joins) to a serialised frame |
expected_output |
the serialised reference result |
Frames are serialised as {"data": <to_json orient="split">, "dtypes": {col: dtype}}. The
dtype map is carried explicitly because to_json alone loses dtypes (int32 returns as int64,
datetimes as strings) and the reward compares dtypes.
How it was built, and why you can trust the answer key
Tasks are defined as (deterministic input frames, instruction, reference solution). The expected output is computed by executing the reference solution, never written by hand, so the answer key cannot drift from the instruction.
Every task is then independently verified:
- the reference solution runs without error and returns a DataFrame
- it is deterministic (executed twice, compared with
assert_frame_equal) - the result is non-empty
- the result is not identical to the input (identity tasks carry no signal)
- both the result and every input frame reproduce exactly through the serialisation round-trip, dtypes included
All 43 tasks pass. The builder and its verifier are open:
build_tasks.py.
Notes
Because grading is an exact frame comparison, column order, row order, the index and dtypes all matter. Prompts state the required index handling and any non-obvious dtype explicitly, so a correct solution is never ambiguous.
- Downloads last month
- -