Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import psycopg2 as pg
- conn = pg.connect(database="magazine_renewal",user="", password="")
- cur = conn.cursor()
- cur.execute("SELECT order_amt FROM customer_orders WHERE order_amt <> 0
- AND order_amt IS NOT NULL LIMIT(10000)")
- records = cur.fetchall()
- cur.close()
- conn.close()
- records[:10]
- [(Decimal('69.95'),),
- (Decimal('79.95'),),
- (Decimal('199.95'),),
- (Decimal('79.95'),),
- (Decimal('69.95'),)]
- from scipy.stats import norm
- import matplotlib.pyplot as plt
- plt.plot(records, norm.pdf(records))
- TypeError Traceback (most recent call last)
- <ipython-input-92-8143f3270f83> in <module>()
- 3
- 4 #x = np.arange(-3, 3, 0.001)
- ----> 5 plt.plot(records, norm.pdf(records))
- /Users/john/Library/Enthought/Canopy/edm/envs/User/lib/python3.5/site-
- packages/scipy/stats/_distn_infrastructure.py in pdf(self, x, *args,
- **kwds)
- 1655 cond = cond0 & cond1
- 1656 output = zeros(shape(cond), dtyp)
- -> 1657 putmask(output, (1-cond0)+np.isnan(x), self.badvalue)
- 1658 if np.any(cond):
- 1659 goodargs = argsreduce(cond, *((x,)+args+(scale,)))
- TypeError: ufunc 'isnan' not supported for the input types, and the
- inputs could not be safely coerced to any supported types according to
- the casting rule ''safe''
Add Comment
Please, Sign In to add comment