Hi thank you both for your ansers.
@Juan  what I have not mentioned in my question is that my timeseries have different lengths, so your advice wouldnt work unless I pad them.
@Oli   your suggestion is very interesting! However, when testing your code I get an error
IndexError: too many indices for tensor of dimension 2
Which python version do you use? (I use python 3.6)
EDIT: I have adjusted the code like this, such that it works also on my system:
index_map = {}
index = 0
    for sample_index, sample in enumerate(data_file):  # First dimension
        for timeseries_index, timeseries in enumerate(sample):  # Second dimension
        index_map[index] = (sample_index, timeseries_index)
        index += 1