79367743

Date: 2025-01-18 18:29:50
Score: 0.5
Natty:
Report link

First of all, you have to do:

newIndex, indexer = a.reindex(b)

reindex returns two things. You need/want to get only the indexer.

So now you can get what you want:

indexerWithNan = np.where(indexer == -1, np.nan, indexer)

Why was your initial code wrong? The reindex() method does not support the fill_value parameter for pandas.Index objects as it does for pandas.Series or pandas.DataFrame.

Reasons:
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: Skapis9999