Advertisement
Guest User

Untitled

a guest
Aug 31st, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. import psycopg2
  2. import struct
  3. import array
  4. import matplotlib.pyplot as plt
  5. import numpy as np
  6. conn = psycopg2.connect(host="127.0.0.1",database="TPAS", user="postgres", password="pass")
  7.    
  8. cur  = conn.cursor()
  9.  
  10. cur.execute("SELECT * FROM muestraraw")
  11. print("The number of parts: ", cur.rowcount)
  12. row = cur.fetchone()
  13. lista = []
  14. while row is not None:
  15.     lista.append(list(row)[10])
  16.     row = cur.fetchone()
  17. cur.close()
  18. conn.close()
  19.  
  20. arr = lista[1]
  21. arrb = arr.tobytes()
  22. array = []
  23. print (len(arrb))
  24. for tx in arrb:
  25.     array.append(tx)
  26.  
  27. #array = np.array(array)
  28. #print (array)
  29.  
  30. plt.plot(array)
  31. plt.show()
  32. #print (arr.tobytes())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement