Practice Change Data Type
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Easy#2886
LeetCode ProblemChange Data Type
Problem Statement
The students DataFrame has student_id (int), name (object), age (int) and grade (float) columns. Convert grade from floating-point to integer values and return the DataFrame with the other columns retained.
Source: Change Data Type on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
DataFrame students: +------------+------+-----+-------+ | student_id | name | age | grade | +------------+------+-----+-------+ | 1 | Ava | 6 | 73.0 | | 2 | Kate | 15 | 87.0 | +------------+------+-----+-------+
Output
+------------+------+-----+-------+ | student_id | name | age | grade | +------------+------+-----+-------+ | 1 | Ava | 6 | 73 | | 2 | Kate | 15 | 87 | +------------+------+-----+-------+
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.