title: how to convert time series 3d numpy array to 2d panda dataframe so that it can be exported as csv
body: <p><a href="https://www.kaggle.com/akshatjn000/smartphone-and-smartwatch-activity-and-biometrics" rel="nofollow noreferrer">Kaggle Dataset and code link </a></p>
  <p>I'm trying to solve the above Kaggle problem and I want to export preprocessed data to a CSV so that I can build a model on weka, but when I'm trying to save it in CSV I'm losing a dimension, I want to retain all the information in that CSV.
  it's a time series based data</p>
  <p>please help me with the relevant code or any resource.</p>
  <p>Thanks</p>
  <pre class="lang-py prettyprint-override"><code>print (scaled_x)
  
      |x           |y          |z          |label
      |1.485231    |-0.661030  |-1.194153  |0
      |0.888257    |-1.370361  |-0.829636  |0
      |0.691523    |-0.594794  |-0.936247  |0
  </code></pre>
  <pre class="lang-py prettyprint-override"><code>Fs=20
  frame_size = Fs*4 #80
  hop_size = Fs*2 #40
      
  def get_frames(df, frame_size, hop_size):
      N_FEATURES = 3
      frames = []
      labels = []
      for i in range(0,len(df )- frame_size, hop_size):
          x = df['x'].values[i: i+frame_size]
          y = df['y'].values[i: i+frame_size]
          z = df['z'].values[i: i+frame_size]
          
          label = stats.mode(df['label'][i: i+frame_size])[0][0]
          frames.append([x,y,z])
          labels.append(label)
          
      frames = np.asarray(frames).reshape(-1, frame_size, N_FEATURES)
      labels = np.asarray(labels)
      
      return frames, labels
  </code></pre>
  <pre class="lang-py prettyprint-override"><code>x,y = get_frames(scaled_x, frame_size, hop_size)
      x.shape, y.shape
  
  ((78728, 80, 3), (78728,))
  </code></pre>