title: ValueError: setting an array element with a sequence (Python)
body: <p>I want to plot a CCDF graph in <strong>Python</strong> by reading data from a text file "data.txt".
  Anyway, I got an error "<strong>ValueError: setting an array element with a sequence</strong>".</p>
  
  <p>Can anyone help me?</p>
  
  <p>Here is my code in python:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  read = np.loadtxt('data.txt')
  with open('data.txt') as f:
      a = [map(float, line.split()) for line in f]
  
  sorted=np.sort(a)
  
  x2 = []
  y2 = []
  y = 0
  for x in sorted: 
      x2.extend([x,x])
      print x2
      y2.append(y)
      y += 1.0 / len(a)
      y2.append(y)
  
  plt.plot(x2,y2)
  plt.show()
  </code></pre>
  
  <p>And here is my text file "data.txt":</p>
  
  <pre><code>9.500000000
  2.500000000
  3.500000000
  4.500000000
  6.500000000
  1.500000000
  </code></pre>