I posted a question similar before, but perhaps I was not clear with the info that I provided. I would like to introduce the values (Supervazio, Vazio...) in 1 column (Tariff) of an existing dataframe based on 2 weekly schedules (Summer and Winter).
My existing dataframe is:
Potência Ativa ...
2019-01-01 00:00:00 31.0 ...
2019-01-01 01:00:00 26.0 ...
2019-01-01 02:00:00 21.0 ...
2019-01-01 03:00:00 21.0 ...
2019-01-01 04:00:00 21.0 ...
and I would like to turn into:
Potência Ativa ... Tarif
2019-01-01 00:00:00 31.0 ... supervazio
2019-01-01 01:00:00 26.0 ... supervazio
2019-01-01 02:00:00 21.0 ... vazio
2019-01-01 03:00:00 21.0 ... vazio
2019-01-01 04:00:00 21.0 ... vazio
etc....
So I tried the previous recommendation,
consumption_year['Tarif'] = np.select([((consumption_year.index.hour >= 2) & (consumption_year.index.hour < 20)) & ((consumption_year.index.weekday >= 0) & (consumption_year.index.weekday <= 4))], [supervazio])
but there are so many conditions as you can see. One of my problems is that I can only call one time
consumption_year['Tarif'] = np.select(...
If not, I would do something like this:
#summer vazio - working day
consumption_year['Tarif'] = np.select(...
(is there a an alternative to add to existing consumption_year['Tarif'] instead of creating a new one?)
#summer vazio - sunday
consumption_year['Tarif'] = np.select(...
Or other simpler method?