Guest User

Untitled

a guest
Jun 2nd, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. import psycopg2 as pg
  2. conn = pg.connect(database="magazine_renewal",user="", password="")
  3. cur = conn.cursor()
  4. cur.execute("SELECT order_amt FROM customer_orders WHERE order_amt <> 0
  5. AND order_amt IS NOT NULL LIMIT(10000)")
  6. records = cur.fetchall()
  7. cur.close()
  8. conn.close()
  9. records[:10]
  10.  
  11. [(Decimal('69.95'),),
  12. (Decimal('79.95'),),
  13. (Decimal('199.95'),),
  14. (Decimal('79.95'),),
  15. (Decimal('69.95'),)]
  16.  
  17. from scipy.stats import norm
  18.  
  19. import matplotlib.pyplot as plt
  20. plt.plot(records, norm.pdf(records))
  21.  
  22. TypeError Traceback (most recent call last)
  23. <ipython-input-92-8143f3270f83> in <module>()
  24. 3
  25. 4 #x = np.arange(-3, 3, 0.001)
  26. ----> 5 plt.plot(records, norm.pdf(records))
  27.  
  28. /Users/john/Library/Enthought/Canopy/edm/envs/User/lib/python3.5/site-
  29. packages/scipy/stats/_distn_infrastructure.py in pdf(self, x, *args,
  30. **kwds)
  31. 1655 cond = cond0 & cond1
  32. 1656 output = zeros(shape(cond), dtyp)
  33. -> 1657 putmask(output, (1-cond0)+np.isnan(x), self.badvalue)
  34. 1658 if np.any(cond):
  35. 1659 goodargs = argsreduce(cond, *((x,)+args+(scale,)))
  36.  
  37. TypeError: ufunc 'isnan' not supported for the input types, and the
  38. inputs could not be safely coerced to any supported types according to
  39. the casting rule ''safe''
Add Comment
Please, Sign In to add comment