I have a problem with storing a numpy array in sqlite database. I have 1 table with Name and Data.
import sqlite3 as sql
from DIP import dip # function to caclculate numpy array
name = input('Enter your full name\t')
data = dip()
con = sql.connect('Database.db')
c = con.cursor()
c.execute("CREATE TABLE IF NOT EXISTS database(Name text, Vein real )")
con.commit()
c.execute("INSERT INTO database VALUES(?,?)", (name, data))
con.commit()
c.execute("SELECT * FROM database")
df = c.fetchall()
print(data)
print(df)
con.close()
Everything is fine but when Data is being stored instead of this:
[('Name', 0.03908678 0.04326234 0.18298542 ..., 0.15228545 0.09972548 0.03992807)]
I have this:
[('Name', b'\xccX+\xa8.\x03\xa4?\xf7\xda[\x1f ..., x10l\xc7?\xbf\x14\x12\)]
What is problem with this? Thank you.
P.S. I tried the solution from here Python insert numpy array into sqlite3 database but it didn't work. And my numpy array is being calculated from skimage (scikit-image) library with HOG (histogram of oriented gradients). Maybe that's a problem... Also tried to calculate and store it from opencv3 but have the same issue.