mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
39 lines
1.1 KiB
HTML
39 lines
1.1 KiB
HTML
<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>
|