I have a pandas df that looks like below.
ts,col1,col2,col3
2024-03-01T08:00:10,50,100,Boston
2024-03-01T09:00:10,20,100,Boston
2024-03-01T08:00:13,50,60,Boston
2024-03-02T08:10:12,50,200,Boston
2024-03-02T08:40:14,50,100,Boston
2024-03-03T09:00:5,50,80,Boston
2024-03-03T10:03:8,50,90,Boston
2024-03-03T08:05:8,50,100,Boston
2024-03-03T09:09:4,50,100,Boston
2024-03-03T12:11:11,50,100,Boston
2024-03-03T15:12:10,50,100,Boston
I want to split the above df into a list of dfs by the date portion. I do not have to explicitly provide the start and end-dates. I want logic to figure out by itself and do the splits. The above should be split into:
df_list = [df1, df2, df3] where:
df1 is
ts,col1,col2,col3
2024-03-01T08:00:10,50,100,Boston
2024-03-01T09:00:10,20,100,Boston
2024-03-01T08:00:13,50,60,Boston
df2 is
ts,col1,col2,col3
2024-03-02T08:10:12,50,200,Boston
2024-03-02T08:40:14,50,100,Boston
df3 is
ts,col1,col2,col3
2024-03-03T09:00:5,50,80,Boston
2024-03-03T10:03:8,50,90,Boston
2024-03-03T08:05:8,50,100,Boston
2024-03-03T09:09:4,50,100,Boston
2024-03-03T12:11:11,50,100,Boston
2024-03-03T15:12:10,50,100,Boston
Currently, I have the ts col as a string. But, I can convert it to timestamp datatype. Beyond that, I do not know how to split automatically.