title: Is there a python friendly function to calculate moving average for 3D data?
body: <p>I am trying to create a smooth contour map by using a simple moving average filter. I have a .CSV that has three column x, y (which are poisition) and z which is the heat at a given x,y. Each column has 23,236 value. I have tried 1d moving average seperatly for x and then for y. Given the size of the data it has been neither fast nor effective at smoothing. I would appricate any help. the code below plots the contour map.</p>
  <p><img src="https://i.stack.imgur.com/1BBMV.png" alt="heat map on a 5x16 m grid" /></p>
  <pre><code>df = 'D:/F1_amp .csv'
  df = pd.read_csv(&quot;F1_amp.csv&quot;);
  Z = df.pivot_table(index='x', columns='y', values='z').T.values
  X_unique = np.sort(df.x.unique())
  Y_unique = np.sort(df.y.unique())
  X, Y = np.meshgrid(X_unique, Y_unique)
  
  pd.DataFrame(Z).round(3)
  pd.DataFrame(X).round(3)
  pd.DataFrame(Y).round(3)
  
  plt.contourf(X, Y, Z, 20, cmap='hot')
  plt.colorbar();
  </code></pre>