I recently made a mysql database using python and imported an excel file into the database. However, I am having some issues with some of the python. Using the following code, I have selected 11 numbers from a table in the database.
# c.execute('SELECT REF_PNL FROM actual_data_table WHERE REF_ENTRY_TIME>"2010-06-29 09:45:00" and REF_ENTRY_TIME<"2010-06-29 10:00:00"') # result1=c.fetchall()
The results come out as follows:
>>>result1 (('15.64',), ('-5.2',), ('24.25',), ('22.18',), ('14.52',), ('21.8',), ('21.2804',), ('-0.13',), ('15.48',), ('2.2',), ('-6.81',))
This is fine, however, I can't seem to do any computations with these numbers. I'm trying to take the average of these numbers using numpy. But then I get this error:
TypeError: cannot perform reduce with flexible type
The result looks like a tuple within a tuple or something. So is there anyway to break the results down into regular computable numbers?
Edited 4 Years Ago by mike_2000_17: Fixed formatting