I have a dataframe (dayData), with two columns 'first'
and 'average'
. I am looking to divide 'first' by 'average' to create a new column 'second'
.
Using the following:
dayData["second"] = dayData["first"] / dayData["average"]
However there is the possibility that 'average' can have a value of 0 in thecolumn (so when I divide the two columns I get a 'NaN' value). I would like to replace the 'NaN' value with zero. Is there a quick way to do this?
Thanks