How to carry out a sum over data indexed by time and grouped by year and month?

It’s much the same:

my_data[:, :year] = year.(my_data.my_seq)
my_data[:, month] = month.(my_data.my_seq)
combine(groupby(my_data, [:year, :month]), :x => sum => sum_of_x)

There are various packages that allow for a more “tidyr” style chaining of commands, like e.g. Chain.jl (which also has a useful comparison between the different chaining packages in it’s Readme, so check out the GitHub page)

1 Like