python - How to set Holidays with Pandas in a timezone-aware way -


I have a panda dataframe, which is indexed hourly with hourly frequency (timezone awareness): < / P>

  & lt; Class 'pandas.tseries.index.DatetimeIndex' & gt; [2014-01-01 00: 00: 00 + 01: 00, ..., 2014-06-30 23: 00: 00 + 02: 00] Length: 4933, Freak: None, Time zone: Europe / Rome  

I want to set all holidays to set 6 (= Sunday) on weekdays. How can I do this from time to time consciously?

It may be inexperienced but it works

  Pandas Categories Import jewelery, Abstrale HolidayCalenter Italian Deliate Italian HolidaysCalendar for importing debit time: Rule = [Holiday ('Pucca', Month = 4, Day = 21), Vacation ('Liberation Day Holiday', 'Republic Day' Month = 6, day = 2)] Calories = Italian Holidays Calendar () Holidays_D = 0, Holiday ('Labor Day', Month = 5, Day = 1) Pd.DataFrame ({}) dd = pd.date_range (datetime ( 2014,1,1,0), period = 24, freq = 'h', tz = 'Europe / Rome') Holidays = Cal.holidays (sliceSum.Datetime.min (). Date (), slicesroom dottime.max (). Date ()) days in holidays: DD = DD.appand (pdade_range (day, day + pd.set offset (hours = 23), Freq = 'H') SliceSm ['Vacation'] = False Piece. Lock [SliceSum.index.Isin (DD), ['Vacation']] = True SliceSm [Silesysolhol] ]head (50)  

Comments