{"task": {"agent_timeout": 1800, "task": "149", "verifier_timeout": 1800, "instruction": "# 149: DS-1000 Task\n\n## Prompt\nProblem:\nExample\nimport pandas as pd\nimport numpy as np\nd = {'l':  ['left', 'right', 'left', 'right', 'left', 'right'],\n     'r': ['right', 'left', 'right', 'left', 'right', 'left'],\n     'v': [-1, 1, -1, 1, -1, np.nan]}\ndf = pd.DataFrame(d)\n\n\nProblem\nWhen a grouped dataframe contains a value of np.NaN I want the grouped sum to be NaN as is given by the skipna=False flag for pd.Series.sum and also pd.DataFrame.sum however, this\nIn [235]: df.v.sum(skipna=False)\nOut[235]: nan\n\n\nHowever, this behavior is not reflected in the pandas.DataFrame.groupby object\nIn [237]: df.groupby('r')['v'].sum()['right']\nOut[237]: 2.0\n\n\nand cannot be forced by applying the np.sum method directly\nIn [238]: df.groupby('r')['v'].apply(np.sum)['right']\nOut[238]: 2.0\n\n\ndesired:\nr\nleft     NaN\nright   -3.0\nName: v, dtype: float64\n\n\nA:\n<code>\nimport pandas as pd\nimport numpy as np\n\n\nd = {'l':  ['left', 'right', 'left', 'right', 'left', 'right'],\n     'r': ['right', 'left', 'right', 'left', 'right', 'left'],\n     'v': [-1, 1, -1, 1, -1, np.nan]}\ndf = pd.DataFrame(d)\n</code>\nresult = ... # put solution in this variable\nBEGIN SOLUTION\n<code>\n\n## What to do\n- Edit `solution/solution.py` so the code passes the DS-1000 tests.\n- Do not access the internet or install new packages; required libraries are preinstalled in the Docker image.\n- Run tests locally via `bash tests/test.sh`.\n\n## Notes\n- Keep the variable names/signatures implied by the prompt/code_context.\n- The evaluator uses the original DS-1000 `code_context` (`test_execution` / `test_string`).\n", "memory": "", "runnable": false, "difficulty": "", "language": "", "cpus": "", "instruction_truncated": false, "category": "", "compose": false, "has_solution": true, "oracle": null, "docker_image": "ds1000:latest", "taskset": "ds1000", "tags": []}, "runs": []}