Skip to content
C

Problem 3: Fix Incorrect Data Types

Easypython

Problem Description

Write a Python program that takes a DataFrame where a numeric column ("age") was loaded as text, converts it to the correct integer type, and prints the data types before and after the fix.

Input

A DataFrame with an "age" column stored as strings.

Output

The data type of "age" before and after conversion.

Constraints

  • All values in "age" are valid numeric strings (no invalid text).

Example Input

text
age = ["21", "20", "19"]

Example Output

text
Before: object After: int64

Concepts Covered

.astype(), dtypes.

Input (stdin)

Output

Run your code to see output here...