1

i want to change the Unique id , dtype from float to object:

0 Unique ID 28621 non-null float64
1 Subjects age 27608 non-null object
2 Subjects gender 28521 non-null object

and i wrote it like this:

fatal_encounters_df[“Unique ID”] = [str(int(item)) for item in fatal_encounters_df[“Unique ID”]]

Getting below error:

ValueError Traceback (most recent call last)
in
----> 1 fatal_encounters_df[“Unique ID”] = [str(int(item)) for item in fatal_encounters_df[“Unique ID”]]

in (.0)
----> 1 fatal_encounters_df[“Unique ID”] = [str(int(item)) for item in fatal_encounters_df[“Unique ID”]]

**ValueError: cannot convert float NaN to integer**

checked the raw file zero nan values unique id starts with 1 and ends with 28621

Equinox
  • 6,483
  • 3
  • 23
  • 32
D Alam
  • 23
  • 5

0 Answers0