I have a dataframe having columns with the a label pattern (name/startDateTime/endDateTime)
pd.DataFrame({
"[RATE] BOJ presser/2024-03-19T07:30:00Z/2024-03-19T10:30:00Z": [1],
"[RATE] BOJ/2024-01-23T04:00:00Z/2024-01-23T07:00:00Z": [2],
"[RATE] BOJ/2024-03-19T04:00:00Z/2024-03-19T07:00:00Z": [3],
"[RATE] BOJ/2024-04-26T03:00:00Z/2024-04-26T06:00:00Z": [4],
"[RATE] BOJ/2024-04-26T03:00:00Z/2024-04-26T08:00:00Z": [5],
"[RATE] BOJ/2024-06-14T03:00:00Z/2024-06-14T06:00:00Z": [6],
"[RATE] BOJ/2024-06-14T03:00:00Z/2024-06-14T08:00:00Z": [7],
"[RATE] BOJ/2024-07-31T03:00:00Z/2024-07-31T06:00:00Z": [8],
"[RATE] BOJ/2024-07-31T03:00:00Z/2024-07-31T08:00:00Z": [9],
"[RATE] BOJ/2024-09-20T03:00:00Z/2024-09-20T06:00:00Z": [10],
"[RATE] BOJ/2024-09-20T03:00:00Z/2024-09-20T08:00:00Z": [11],
"[RATE] BOJ/2024-10-31T04:00:00Z/2024-10-31T07:00:00Z": [12],
"[RATE] BOJ/2024-10-31T04:00:00Z/2024-10-31T09:00:00Z": [13],
"[RATE] BOJ/2024-12-19T04:00:00Z/2024-12-19T07:00:00Z": [14],
"[RATE] BOJ/2024-12-19T04:00:00Z/2024-12-19T09:00:00Z": [15],
})
I would like to merge the columns (summing its values) having same name and start date (without the time), the column name should be the orignal one (First to be used)
This should give the following result
pd.DataFrame({
"[RATE] BOJ presser/2024-03-19T07:30:00Z/2024-03-19T10:30:00Z": [1],
"[RATE] BOJ/2024-01-23T04:00:00Z/2024-01-23T07:00:00Z": [2],
"[RATE] BOJ/2024-03-19T04:00:00Z/2024-03-19T07:00:00Z": [3],
"[RATE] BOJ/2024-04-26T03:00:00Z/2024-04-26T06:00:00Z": [9],
"[RATE] BOJ/2024-06-14T03:00:00Z/2024-06-14T06:00:00Z": [13],
"[RATE] BOJ/2024-07-31T03:00:00Z/2024-07-31T06:00:00Z": [17],
"[RATE] BOJ/2024-09-20T03:00:00Z/2024-09-20T06:00:00Z": [21],
...
})
In my example, every column has one raw, but in reality it has multiple based on datetime index