I am building a data pipeline in Pandas, and any given number can be
- Explicitly:
0
- Missing (
np.nan
) - Missing, but imputed to have a value of
0
I'd like to replace the imputed 0's in the table with a value that indicates that they have been imputed. The best I could think of was a "0" where the repr
is "-"
I tried:
class MyNaNThatIsLikeZero(int):
def __repr__(self):
return '-'
myNaN = MyNaNThatIsLikeZero()
But pandas is converting this to just the float 0.0
To clarify, I need this value to behave as 0, so it needs to implement all the dunder methods