{ "data": { "question": { "questionId": "3067", "questionFrontendId": "2884", "boundTopicId": null, "title": "Modify Columns", "titleSlug": "modify-columns", "content": "
\nDataFrame employees
\n+-------------+--------+\n| Column Name | Type |\n+-------------+--------+\n| name | object |\n| salary | int |\n+-------------+--------+\n
\n\nA company intends to give its employees a pay rise.
\n\nWrite a solution to modify the salary
column by multiplying each salary by 2.
The result format is in the following example.
\n\n\n
Example 1:
\n\n\nInput:\nDataFrame employees\n+---------+--------+\n| name | salary |\n+---------+--------+\n| Jack | 19666 |\n| Piper | 74754 |\n| Mia | 62509 |\n| Ulysses | 54866 |\n+---------+--------+\nOutput:\n+---------+--------+\n| name | salary |\n+---------+--------+\n| Jack | 39332 |\n| Piper | 149508 |\n| Mia | 125018 |\n| Ulysses | 109732 |\n+---------+--------+\nExplanation:\nEvery salary has been doubled.\n", "translatedTitle": null, "translatedContent": null, "isPaidOnly": false, "difficulty": "Easy", "likes": 25, "dislikes": 3, "isLiked": null, "similarQuestions": "[]", "exampleTestcases": "{\"headers\":{\"employees\":[\"name\",\"salary\"]},\"rows\":{\"employees\":[[\"Jack\",19666],[\"Piper\",74754],[\"Mia\",62509],[\"Ulysses\",54866]]}}", "categoryTitle": "pandas", "contributors": [], "topicTags": [], "companyTagStats": null, "codeSnippets": [ { "lang": "Pandas", "langSlug": "pythondata", "code": "import pandas as pd\n\ndef modifySalaryColumn(employees: pd.DataFrame) -> pd.DataFrame:\n ", "__typename": "CodeSnippetNode" } ], "stats": "{\"totalAccepted\": \"11K\", \"totalSubmission\": \"12.3K\", \"totalAcceptedRaw\": 11045, \"totalSubmissionRaw\": 12333, \"acRate\": \"89.6%\"}", "hints": [ "Considering multiplying each salary value by 2, using a simple assignment operation. The calculation of the value is done column-wise." ], "solution": { "id": "2110", "canSeeDetail": true, "paidOnly": false, "hasVideoSolution": false, "paidOnlyVideo": true, "__typename": "ArticleNode" }, "status": null, "sampleTestCase": "{\"headers\":{\"employees\":[\"name\",\"salary\"]},\"rows\":{\"employees\":[[\"Jack\",19666],[\"Piper\",74754],[\"Mia\",62509],[\"Ulysses\",54866]]}}", "metaData": "{\n \"pythondata\": [\n \"employees = pd.DataFrame([], columns=['name', 'salary']).astype({'name':'object', 'salary':'Int64'})\"\n ],\n \"database\": true,\n \"name\": \"modifySalaryColumn\",\n \"languages\": [\n \"pythondata\"\n ]\n}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [], "enableRunCode": true, "enableTestMode": false, "enableDebugger": false, "envInfo": "{\"pythondata\": [\"Pandas\", \"
Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0
\"]}", "libraryUrl": null, "adminUrl": null, "challengeQuestion": null, "__typename": "QuestionNode" } } }