title: Best data structure for 3D data?
body: <p>I have some data, which is a function of two variables, let's say a and b. </p>
  
  <pre><code>f(a,b)
  </code></pre>
  
  <p>In maths terms, we can think of f as a surface viewed in 3D. The problem is, what is a good data structure to store this data in? I need to plot f as a function of a for constant b and f as a function of b for constant a. Currently I'm using a dict of arrays, something like this:</p>
  
  <pre><code>  f['a1'] = [b1,b2,b3]
  </code></pre>
  
  <p>but then if I now want to plot f as a function of a with b constant I have to re-make another dict by hand:</p>
  
  <pre><code>  f['b1'] = [a1,a2,a3]
  </code></pre>
  
  <p>which is proving extremely cumbersome and makes my code unreadable. Is there a nice way to store such 3D data in some numpy data structure or using built in python data structures?</p>