1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/originData/fill-missing-data.json
2023-12-09 19:57:46 +08:00

55 lines
5.7 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": "3070",
"questionFrontendId": "2887",
"categoryTitle": "pandas",
"boundTopicId": 2467496,
"title": "Fill Missing Data",
"titleSlug": "fill-missing-data",
"content": "<pre>\nDataFrame <code>products</code>\n+-------------+--------+\n| Column Name | Type |\n+-------------+--------+\n| name | object |\n| quantity | int |\n| price | int |\n+-------------+--------+\n</pre>\n\n<p>Write a solution to fill in the missing value as <code><strong>0</strong></code> in the <code>quantity</code> column.</p>\n\n<p>The result format is in the following example.</p>\n\n<p>&nbsp;</p>\n<pre>\n<strong class=\"example\">Example 1:</strong>\n<strong>Input:</strong>+-----------------+----------+-------+\n| name | quantity | price |\n+-----------------+----------+-------+\n| Wristwatch | None | 135 |\n| WirelessEarbuds | None | 821 |\n| GolfClubs | 779 | 9319 |\n| Printer | 849 | 3051 |\n+-----------------+----------+-------+\n<strong>Output:\n</strong>+-----------------+----------+-------+\n| name | quantity | price |\n+-----------------+----------+-------+\n| Wristwatch | 0 | 135 |\n| WirelessEarbuds | 0 | 821 |\n| GolfClubs | 779 | 9319 |\n| Printer | 849 | 3051 |\n+-----------------+----------+-------+\n<strong>Explanation:</strong> \nThe quantity for Wristwatch and WirelessEarbuds are filled by 0.</pre>\n",
"translatedTitle": "填充缺失值",
"translatedContent": "<pre>\nDataFrame <code>products</code>\n+-------------+--------+\n| Column Name | Type |\n+-------------+--------+\n| name | object |\n| quantity | int |\n| price | int |\n+-------------+--------+\n</pre>\n\n<p>编写一个解决方案,在 <code>quantity</code> 列中将缺失的值填充为&nbsp;<code><strong>0</strong></code>。</p>\n\n<p>返回结果如下示例所示。</p>\n\n<p>&nbsp;</p>\n<strong class=\"example\">示例 1</strong>\n\n<pre>\n<strong>输入:\n</strong>+-----------------+----------+-------+\n| name | quantity | price |\n+-----------------+----------+-------+\n| Wristwatch | 32 | 135 |\n| WirelessEarbuds | None | 821 |\n| GolfClubs | None | 9319 |\n| Printer | 849 | 3051 |\n+-----------------+----------+-------+\n<strong>输出:\n</strong>+-----------------+----------+-------+\n| name | quantity | price |\n+-----------------+----------+-------+\n| Wristwatch | 32 | 135 |\n| WirelessEarbuds | 0 | 821 |\n| GolfClubs | 0 | 9319 |\n| Printer | 849 | 3051 |\n+-----------------+----------+-------+\n<b>解释:</b>\nToaster 和 Headphones 的数量被填充为 0。</pre>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 0,
"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 fillMissingValues(products: pd.DataFrame) -> pd.DataFrame:\n ",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"1.3K\", \"totalSubmission\": \"1.8K\", \"totalAcceptedRaw\": 1277, \"totalSubmissionRaw\": 1822, \"acRate\": \"70.1%\"}",
"hints": [
"Consider using a build-in function in pandas library to fill the missing values of specified columns."
],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"products\":[\"name\",\"quantity\",\"price\"]},\"rows\":{\"products\":[[\"Wristwatch\",null,135],[\"WirelessEarbuds\",null,821],[\"GolfClubs\",779,9319],[\"Printer\",849,3051]]}}",
"metaData": "{\n \"pythondata\": [\n \"products = pd.DataFrame([], columns=['name', 'quantity', 'price']).astype({'name':'object', 'quantity':'Int64', 'price':'Int64'})\"\n ],\n \"database\": true,\n \"name\": \"fillMissingValues\",\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\":{\"products\":[\"name\",\"quantity\",\"price\"]},\"rows\":{\"products\":[[\"Wristwatch\",null,135],[\"WirelessEarbuds\",null,821],[\"GolfClubs\",779,9319],[\"Printer\",849,3051]]}}",
"__typename": "QuestionNode"
}
}
}