'wrong result shown in converting float to integer in pd

pandas

hi i want to ask why i convert to int but the result still remain as float64



Solution 1:[1]

As shown in the pandas docs, the method returns a new DataFrame. This means that you want to store the result in the variable df_cleaned to override the previous value:

df_cleaned = df_cleaned.convert_dtypes(convert_integer=True)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 aaossa