Suppose that each product has different versions that change over time, and I have a data set of time observations with the product id, version id and other data
I am interested in the Cartesian product of the indices of successive versions. i.e. the cartesian products of the indices of version_1
and version_2
, version_2
and version_3
and version_3
and version_4
.
For example the cartesian product of version_1
and version_2
is: (0,3), (1,3), (2,3), (0,4), (1,4), (2,4), version_2
and version_3
is (3,5), (3,6), (3,7), (4,5), (4,6), (4,7), etc. Ideally I would like two arrays: one of the left indices and one of the right.
Any hints as to how this can be done efficiently using numpy rather than manually looping which is very slow.