So basically, I have a load text file in python, containing months and the weather in those months. I'm trying to define a period of the year as "summer", being june, july and august, which are given by their numbers 6, 7 and 8 respectively. I tried to do it using np.where(( month == 6, 7, 8)) or np.where((month == 6) & (month ==7 ect, ect. Is there any way that I can use np.where to achieve this? Or is there another function that I should use? Thanks in advance!
Asked
Active
Viewed 41 times
0
-
You need to put each condition in different paranthesis, also you need to use OR symbol ( | ), not AND (&). np.where( (month == 6) | (month == 7) ). – unlut Oct 14 '20 at 23:23
-
Yes thanks! That worked perfectly! – Declan Oct 16 '20 at 00:49