I'm working with frames and I'm trying to transform a variable where months and dates are strings into a new variable season
. However my if conditional statements below will only make a new var season
where everything is spring
(probably because it's the first if statement), everything else is ignored.
Anyone got any clue as to why?
if 'september' or 'october' or 'november' in labels['str_date']:
labels['season'] = 'spring'
if 'december' or 'january' or 'febuary' in labels['str_date']:
labels['season'] = 'summer'
if 'march' or 'april' or 'may' in labels['str_date']:
labels['season'] = 'autumn'
if 'june' or 'july' or 'august' in labels['str_date']:
labels['season'] = 'winter'
else:
labels['season'] = 'null'
#labels.loc[(labels.season == 'spring')].value_counts()
#labels
sns.countplot(x='season', data=(labels))
plt.show()
subset of the df = labels
: