79353186

Date: 2025-01-13 18:57:06
Score: 0.5
Natty:
Report link

If the dtype becoming float is not a concern, then np.ma might be useful for working with this:

(np.ma.masked_invalid(df['a']) == np.ma.masked_invalid(df['b'])).astype(float).filled(np.nan)

This masks nan in the comparison, then replaces masked values back with nan.

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: M. Zhang