1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/originData/modify-columns.json

55 lines
5.1 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"data": {
"question": {
"questionId": "3067",
"questionFrontendId": "2884",
"categoryTitle": "pandas",
"boundTopicId": 2467492,
"title": "Modify Columns",
"titleSlug": "modify-columns",
"content": "<pre>\nDataFrame <code>employees</code>\n+-------------+--------+\n| Column Name | Type |\n+-------------+--------+\n| name | object |\n| salary | int |\n+-------------+--------+\n</pre>\n\n<p>A company intends to give its employees a pay rise.</p>\n\n<p>Write a solution to <strong>modify</strong> the <code>salary</code> column by multiplying each salary by 2.</p>\n\n<p>The result format is in the following example.</p>\n\n<p>&nbsp;</p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:\n</strong>DataFrame employees\n+---------+--------+\n| name | salary |\n+---------+--------+\n| Jack | 19666 |\n| Piper | 74754 |\n| Mia | 62509 |\n| Ulysses | 54866 |\n+---------+--------+\n<strong>Output:\n</strong>+---------+--------+\n| name | salary |\n+---------+--------+\n| Jack | 39332 |\n| Piper | 149508 |\n| Mia | 125018 |\n| Ulysses | 109732 |\n+---------+--------+\n<strong>Explanation:\n</strong>Every salary has been doubled.</pre>\n",
"translatedTitle": "修改列",
"translatedContent": "<pre>\nDataFrame <code>employees</code>\n+-------------+--------+\n| Column Name | Type |\n+-------------+--------+\n| name | object |\n| salary | int |\n+-------------+--------+\n</pre>\n\n<p>一家公司决定增加员工的薪水。</p>\n\n<p>编写一个解决方案将每个员工的薪水乘以2来 <strong>修改</strong>&nbsp;<code>salary</code>&nbsp;列。</p>\n\n<p>返回结果格式如下示例所示。</p>\n\n<p>&nbsp;</p>\n\n<p><b>示例 1:</b></p>\n\n<pre>\n<strong>输入:\n</strong>DataFrame employees\n+---------+--------+\n| name | salary |\n+---------+--------+\n| Jack | 19666 |\n| Piper | 74754 |\n| Mia | 62509 |\n| Ulysses | 54866 |\n+---------+--------+\n<strong>输出:\n</strong>+---------+--------+\n| name | salary |\n+---------+--------+\n| Jack | 39332 |\n| Piper | 149508 |\n| Mia | 125018 |\n| Ulysses | 109732 |\n+---------+--------+\n<strong>解释:\n</strong>每个人的薪水都被加倍。</pre>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 1,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"typescript\": false, \"bash\": false, \"php\": false, \"swift\": false, \"kotlin\": false, \"dart\": false, \"golang\": false, \"ruby\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"rust\": false, \"racket\": false, \"erlang\": false, \"elixir\": false, \"pythondata\": false, \"react\": false, \"vanillajs\": false, \"postgresql\": false}",
"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\": \"1.5K\", \"totalSubmission\": \"1.6K\", \"totalAcceptedRaw\": 1457, \"totalSubmissionRaw\": 1579, \"acRate\": \"92.3%\"}",
"hints": [
"Considering multiplying each salary value by 2, using a simple assignment operation. The calculation of the value is done column-wise."
],
"solution": null,
"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,
"envInfo": "{\"pythondata\":[\"Pandas\",\"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "{\"headers\":{\"employees\":[\"name\",\"salary\"]},\"rows\":{\"employees\":[[\"Jack\",19666],[\"Piper\",74754],[\"Mia\",62509],[\"Ulysses\",54866]]}}",
"__typename": "QuestionNode"
}
}
}