mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
41 lines
1.0 KiB
HTML
41 lines
1.0 KiB
HTML
<pre>
|
|
DataFrame <code>students</code>
|
|
+-------------+--------+
|
|
| Column Name | Type |
|
|
+-------------+--------+
|
|
| student_id | int |
|
|
| name | object |
|
|
| age | int |
|
|
| grade | float |
|
|
+-------------+--------+
|
|
</pre>
|
|
|
|
<p>编写一个解决方案来纠正以下错误:</p>
|
|
|
|
<p> <code>grade</code> 列被存储为浮点数,将它转换为整数。</p>
|
|
|
|
<p>返回结果格式如下示例所示。</p>
|
|
|
|
<p> </p>
|
|
|
|
<p><strong>示例 1:</strong></p>
|
|
|
|
<pre>
|
|
<strong>输入:
|
|
</strong>DataFrame students:
|
|
+------------+------+-----+-------+
|
|
| student_id | name | age | grade |
|
|
+------------+------+-----+-------+
|
|
| 1 | Ava | 6 | 73.0 |
|
|
| 2 | Kate | 15 | 87.0 |
|
|
+------------+------+-----+-------+
|
|
<strong>输出:
|
|
</strong>+------------+------+-----+-------+
|
|
| student_id | name | age | grade |
|
|
+------------+------+-----+-------+
|
|
| 1 | Ava | 6 | 73 |
|
|
| 2 | Kate | 15 | 87 |
|
|
+------------+------+-----+-------+
|
|
<b>解释:</b>
|
|
grade 列的数据类型已转换为整数。</pre>
|