Groupby and resample timeseries so date ranges are consistent
问题 I have a dataframe which is basically several timeseries stacked on top of one another. Each time series has a unique label (group) and they have different date ranges. date = pd.to_datetime(pd.Series(['2010-01-01', '2010-01-02', '2010-01-03', '2010-01-06', '2010-01-01', '2010-01-03'])) group = [1,1,1,1, 2, 2] value = [1,2,3,4,5,6] df = pd.DataFrame({'date':date, 'group':group, 'value':value}) df date group value 0 2010-01-01 1 1 1 2010-01-02 1 2 2 2010-01-03 1 3 3 2010-01-06 1 4 4 2010-01-01