I have a rather strange issue with np.where that is making question whether I should use another function instead.
The logic is the following: If and only if "trendup" AND "trendown" are 'False', then "No_trend", otherwise "trending"
somehow the output is wrong but i am not sure what is off.
Id Trendup Trendown
0 001 False False
1 002 False False
and the line of code is:
forecast['trend_status'] = np.where((forecast['Trendup'] == 'False') & (forecast['Trendown'] == 'False'), 'Not_trending', 'trending')
and the wrong output:
Id Trendup Trendown trend_status
0 001 False False trending
1 002 False False trending
In this case it should be "Not_trending" in the trend_status column since the two previous columns are False. I am guessing that the issue is the & statement. I have looked at np.logical_and() but it does not seem that it is what I look for. Any help would be welcome
UPDATE: Thanks to @Yatu, I have tryed:
forecast['trend_status'] = np.where(~(forecast['Trendup'] & forecast['Trendown']), 'Not_trending', 'trending')
but when I play with my dataset to show some trend the issue is still there
0 001 False True Not_trending
1 002 False True Not_trending
What could be going wrong? I have been so close to this issue now that I may be failing to see the obvious.