title: How to save string and array in the same row into csv by using python?
body: <p>I have a vector, it is <code>np.array([[1,2,3]])</code>.</p>
  
  <p>I want to save the vector and the name of the vector in the same row.</p>
  
  <p>For example </p>
  
  <p>Vector1 1 2 3</p>
  
  <p>Vector2 4 5 6</p>
  
  <p>Vector3 7 8 9</p>
  
  <p>Then, I have ever tried like this</p>
  
  <pre><code>import csv
  import numpy as np
  a=np.array([[1,2,3]])
  b='Vector1'
  c=[b,a]
  with open ('testfile.csv','ab') as fxx:
          w=csv.writer(fxx)
          for row in c:
              w.writerow(row)
  </code></pre>
  
  <p>the result is
  <a href="https://i.stack.imgur.com/vxJXd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vxJXd.png" alt="enter image description here"></a></p>
  
  <p>then I also have tried this</p>
  
  <pre><code>import csv
  import numpy as np
  a=np.array([[1,2,3]])
  b='Vector1'
  c=np.append(b,a)
  with open ('testfile3.csv','ab') as fxx:
          w=csv.writer(fxx)
          for row in c:
              w.writerow(row)
  </code></pre>
  
  <p>And then the result is
  <a href="https://i.stack.imgur.com/Nb3tG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nb3tG.png" alt="enter image description here"></a></p>
  
  <p>But the result what I want is
  <a href="https://i.stack.imgur.com/H0zAA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H0zAA.png" alt="enter image description here"></a></p>