I have an np.where problem using Pandas that is driving me crazy and I can\'t seem to solve through Google, the documentation, etc.
I\'m hoping someone has insight.
You need to pass the boolean mask and the (two) values columns:
np.where(Full_Names_Test_2['MarketCap'] == 'n/a', 7)
# should be
np.where(Full_Names_Test_2['MarketCap'] == 'n/a', Full_Names_Test_2['MarketCap'], 7)
See the np.where docs.
or alternatively use the where Series method:
Full_Names_Test_2['MarketCap'].where(Full_Names_Test_2['MarketCap'] == 'n/a', 7)