title: Double key dictionary in Python
body: <p>I am performing some computations and I'm sure there is a better way to store the information I have than what I'm currently doing.</p>
  <p>Currently, I have a dictionary of dictionaries of the form</p>
  <p><code>mydict[timestep][node] = {'property1' : value, 'property2' : value, ...}</code></p>
  <p>This data structure is fine when I want to have a full picture of all nodes at a certain timestep, e.g <code>mydict[timestep] = {'node1': {...}, 'node2': {...}, ...}</code>. However, it is a bit annoying when I need the opposite: given a certain node, retrieve a dictionary of what happens to it at each timestep. Something like <code>mydict[node] = {'timestep1': {...}, 'timestep2' : {...}, ...}</code> would be awesome.</p>
  <p>I can manually code a workaround, however I feel that there should be a better way to do so. I've seen similar questions online whose solution was having tuples as single keys, however I don't think that is suitable for me.</p>
  <p>I've considered using a Pandas dataframe but I am not sure about it, as during the computations <code>mydict</code> is constantly being changed and my experience is that such dataframes are more suitable for static datasets.</p>
  <p>Please let me know any ideas you might have, and thanks for your time!</p>