There is no limitation for the value of the groups:
The value of the groups does not matter as long as samples in the same group have the same value.
However, if group column has str type, than np.isnan() will throw exception as:

This will be easily solved with changing to df.isna().
