A separate form of aggregation is time-based resampling. You can think of this practice as grouping by time period—except that statistics will be filled for missed time periods, too.
For example, let's count casualties for each month of the war, assuming the end of each battle as a time point. For that, we'll have to set DateTime as an index, first. For the sake of simplicity, let's create a copy of the dataframe to perform on:
ts = data[['axis killed', 'allies killed', 'end']].copy()
ts = ts.set_index('end').sort_index()
Now, all we need to do is define the frequency and aggregation method, and we're good to go:
>>> timeline = ts.resample('1Y').agg('sum')
>>> timeline
axis killed allies killed
end
1939-12-31 23727.0 166092.0
1940-12-31 36682.0 2741.0
1941-12-31 226230.0 1644334.0
1942-12-31 346949.0 2300836.0
1943-12-31 1110704.0 1456498.0
1944-12-31 640690.0 770208.0
1945-12-31 684689.0 622996.0
Moreover, for all of the dataframes and series with the DateTime index, pandas will plot the line charts automatically, one per column. Running timeline.plot() will get us to the following diagram. Here, we can estimate the number of casualties on both sides every year:
The resulting time series is remarkable! It also reminds us that, aside from time, we have location coordinates for most of the battles. Can we use those to create maps? You bet!