I have this operation:
df['netPCR'] = df['ValorNeto'] / df.index.map(PCR['ValorNeto'])
df['netPCR'] = df['netPCR'].fillna(0)
But some how when
It results in inf and when I try to get what values are inf things just get weird.
What do you think it is happening and how to fix it?
I tried to round values or convert them to objects, but the problem is not fixed.
It seems like division by 0 is returning infinity and not nan. You can use
df.replace([np.inf, -np.inf], 0, inplace=True)
Answered By – QWERTYL
Answer Checked By – Willingham (BugsFixing Volunteer)