# Predict variable from time series when there are many observations in the same date

I have dataframe that is similar to this:

date=['2020-01-01','2020-01-01','2020-01-01','2020-01-01','2020-02-01','2020-02-01','2020-02-01','2020-02-01','2020-03-01','2020-03-01','2020-03-01','2020-03-01','2020-01-01','2020-01-01','2020-01-01','2020-01-01','2020-02-01','2020-02-01','2020-02-01','2020-02-01','2020-03-01','2020-03-01','2020-03-01','2020-03-01']
index=['A','B','C','D','A','B','C','D','A','B','C','D','A','B','C','D','A','B','C','D','A','B','C','D']
ids=['1','1','1','1','1','1','1','1','1','1','1','1','2','2','2','2','2','2','2','2','2','2','2','2']
vals=[0.1,2.2,2.1,4.5,2.3,1.1,9.9,8.8,9.1,2.2,1.2,11,0.1,2.2,2.1,4.2,2.3,1.1,9.9,4.1,9.1,5.5,5.2,7]
final=[5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,3.3,3.3,3.3,3.3,3.3,3.3,3.3,3.3,3.3,3.3,3.3,3.3,]

tmp=pd.DataFrame(list(zip(ids,date,index,vals,final)),columns=['ids','date','index','value',to_predict'])
tmp

>>>
ids date    index   value   to_predict
0   1   2020-01-01  A   0.1 5.5
1   1   2020-01-01  B   2.2 5.5
2   1   2020-01-01  C   2.1 5.5
3   1   2020-01-01  D   4.5 5.5
4   1   2020-02-01  A   2.3 5.5
5   1   2020-02-01  B   1.1 5.5
6   1   2020-02-01  C   9.9 5.5
7   1   2020-02-01  D   8.8 5.5
8   1   2020-03-01  A   9.1 5.5
9   1   2020-03-01  B   2.2 5.5
10  1   2020-03-01  C   1.2 5.5
11  1   2020-03-01  D   11.0 5.5
12  2   2020-01-01  A   0.1 3.3
13  2   2020-01-01  B   2.2 3.3
14  2   2020-01-01  C   2.1 3.3
15  2   2020-01-01  D   4.2 3.3
16  2   2020-02-01  A   2.3 3.3
17  2   2020-02-01  B   1.1 3.3
18  2   2020-02-01  C   9.9 3.3
19  2   2020-02-01  D   4.1 3.3
20  2   2020-03-01  A   9.1 3.3
21  2   2020-03-01  B   5.5 3.3
22  2   2020-03-01  C   5.2 3.3
23  2   2020-03-01  D   7.0 3.3


The dataframe has two unique ids (originally it has much more), and records from different dates, when for each date there are values of different indices. so for example for for date 2020-01-01, each id will have 4 values from each index.

I want to predict the value in the column to_predict based on the time series of each index, for example the timeseries of ID 1 and index A:

tmp['date']=pd.to_datetime(tmp['date'])
tmp=tmp.set_index('date')
tmp[(tmp['ids']=='1')&(tmp['index']=='A')]['value'].plot()


Index A:

Index B:

... take the time series also for indices B,C,D and create model that can predict in the end the value in "to_predict" column.

I have seen some regression models of time series data, but seems like they are predicitng how the time series will look in the future, while I want to predict value based on exisiting time series.

So my end goal is to be able to take oone observation, that has 4 time-serieses , and predict based on these 4 time serises the "to_predict" column looking mainly for methods to do that.