Im tring to pull data once from Mysql into “c.”
Then create an NUMPY array and a dict from the data.
It seems that once I zip ‘c’ it no longer stay in orig form.
Can this be done?
import csv, pyodbc#,
from numpy import *
import numpy as np
csr = cxn.cursor()
c = csr.execute("Select * from p.s")
s = zip(*c)
data = s[0]
for each in data:
v= dict((each, []) for each in data)
print v
d=[]
for each in c:
d.append(each)
a = asarray(d)
print a
A few more comments:
This code
creates the same dictionary over and over again. You can simply drop the outer for-loop and will get the same result.
The part
is equivalent to
Your whole code can be written as