From a database file I read datetime and values column and I'm trying to plot by using matplotlib and plt.plot(x, y) where x is datetime and y is values column but I get the error:
TypeError: unhashable type: 'numpy.ndarray'
Here below how my data looks like:
Both data are tuple type:
I searched for the error but didn't help for my case. I can plot plt.plot(y) without any problem but when I try plt.plot(x, y) I get the error. How can this be remedied?
edit:
x is created as follows:
def getAllRows():
try:
connection = sqlite3.connect('C:/Users/user/Documents/Python Scripts/file.db')
cursor = connection.cursor()
print("Connected to SQLite")
sqlite_select_query = 'SELECT DateTime FROM Parameters_1_3_1'
cursor.execute(sqlite_select_query)
records = cursor.fetchall()
print("Total rows are: ", len(records))
print("Printing each row")
cursor.close()
return records;
except sqlite3.Error as error:
print("Failed to read data from table", error)
finally:
if connection:
connection.close()
print("The Sqlite connection is closed")
x = getAllRows()
In console x outputs as:


