mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-06 16:01:41 +08:00
update
This commit is contained in:
38
leetcode/problem/change-data-type.html
Normal file
38
leetcode/problem/change-data-type.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<pre>
|
||||
DataFrame <code>students</code>
|
||||
+-------------+--------+
|
||||
| Column Name | Type |
|
||||
+-------------+--------+
|
||||
| student_id | int |
|
||||
| name | object |
|
||||
| age | int |
|
||||
| grade | float |
|
||||
+-------------+--------+
|
||||
</pre>
|
||||
|
||||
<p>Write a solution to correct the errors:</p>
|
||||
|
||||
<p>The <code>grade</code> column is stored as floats, convert it to integers.</p>
|
||||
|
||||
<p>The result format is in the following example.</p>
|
||||
|
||||
<p> </p>
|
||||
<pre>
|
||||
<strong class="example">Example 1:</strong>
|
||||
<strong>Input:
|
||||
</strong>DataFrame students:
|
||||
+------------+------+-----+-------+
|
||||
| student_id | name | age | grade |
|
||||
+------------+------+-----+-------+
|
||||
| 1 | Ava | 6 | 73.0 |
|
||||
| 2 | Kate | 15 | 87.0 |
|
||||
+------------+------+-----+-------+
|
||||
<strong>Output:
|
||||
</strong>+------------+------+-----+-------+
|
||||
| student_id | name | age | grade |
|
||||
+------------+------+-----+-------+
|
||||
| 1 | Ava | 6 | 73 |
|
||||
| 2 | Kate | 15 | 87 |
|
||||
+------------+------+-----+-------+
|
||||
<strong>Explanation:</strong>
|
||||
The data types of the column grade is converted to int.</pre>
|
Reference in New Issue
Block a user