title: Is there a way to write a one column pd data frame on top of a mxn pd dataframe to a text file in Python
body: <p>I have two data frames of different dimensions that I want to write to a text (.txt) file such that one is on top of the other. I'm sure it's easy but I have no way of doing it.
  The data I want to write is:</p>
  <pre><code>import numpy as np
  import pandas as pd
  
  preamble = pd.DataFrame(np.array([&quot;software&quot;, &quot;version&quot;, &quot;frequency: 100&quot;, &quot;firmware:100.10.1&quot;]).T)
  
  data = pd.DataFrame.from_dict({&quot;frame&quot;: np.array([1, 2, 3, 4, 5]), &quot;X&quot;: np.array([2,4,6,8,10]), &quot;Y&quot;: np.array([3,6,9,12,15]), &quot;Z&quot;: np.array([1,2,3,4,5])})
  </code></pre>
  <p>I want to create a text file that looks like this:</p>
  <pre><code>software
  version
  frequency:100
  firmware: 100.10.1
  frame    X     Y    Z
  1        2     3    1
  2        4     6    2
  3        6     8    3
  4        8     10   4
  5        10    12   5
  </code></pre>
  <p>I tried to get the format correctly at the top end.</p>
  <p>I want to keep the [frame, X, Y, Z] headers where they are. But place the &quot;preamble&quot; at the top in a column.</p>
  <p>I've tried to append and combine the two data frames, but can't do it. I don't think that's possible.</p>
  <p>I've tried looking for ways to write the preamble in cell (column = 1, row = 1) and then start the data in cell (column = 1, row = 5).</p>
  <p>Any help here would be appreciated! Please let me know if you need more information!</p>