In categorical data i have replace NAN values with most frequent onces but when i try fit in OneHotEncoder, this error is showing

IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

Can you share the code where you are getting this error?