mysql - Python dictionary not storing all the rows in form of key value pair -
newbie in python. in below code fetching 4610 rows db
, storing them in dictionary pattern. extracting rows till second last line of code , normalize()
decimal values when printing len(sdivalues)
146. should 4600.
#len(sdidata) = 4610rows fetched mysql db data in sdidata: ibesticker =data[1].strip() key = (data[0],ibesticker) if(data[3] != none): periodyear = datetime.datetime.strptime(data[3], "%y-%m-%d") val = float(data[10].normalize()) print val #returns 4600 values sdivalues[key] = [periodyear.year, val, periodyear.month] # wrong here guess print len(sdivalues) # 146 rows
Comments
Post a Comment