if your learning rate is too big model will diverge which eventually would lead to an Inf/NaN.
Aaand the second option is there is a NaN in the input data. Which may not appear in the data frame but after preprocessing?