My issue is very simple, but I just can't wrap my head around it: I have two dataframes:
- time series dataframewith two columns:TimestampandDataValue
- A time interval dataframewithstart,endtimestamps and a label
What I want to do:
Add a third column to the timeseries that yields the labels according to the time interval dataframe. 
Every timepoint needs to have an assigned label designated by the time interval dataframe.
This code works:
TimeSeries_labelled = TimeSeries.copy(deep=True)
TimeSeries_labelled["State"] = 0
for index in Timeintervals_States.index:
    for entry in TimeSeries_labelled.index:
         if Timeintervals_States.loc[index,"start"] <= TimeSeries_labelled.loc[entry, "Timestamp"] <=     Timeintervals_States.loc[index,"end"]:
             TimeSeries_labelled.loc[entry, "State"] = Timeintervals_States.loc[index,"state"]
But it is really slow. I tried to make it shorter and faster with pyhton built in filter codes, but failed miserably. Please help!
 
     
    