title: Trying to plot SQL datetime data in PyQt5 GUI
body: <p>I'm creating a simple GUI with a visualization feature. I'm querying a database to get the data I need which I in turn then want to plot and show in my GUI.</p>
  <p>The code for the query and plot is below:</p>
  <pre><code>class Sheet(QMainWindow):
      def __init__(self,parent=None):
          super().__init__(parent)
          self.ui = Ui_MainWindow()
          self.ui.setupUi(self)
          self.setUpCanvasUi()
          self.connectSignalSlots()
          
      
      def setUpCanvasUi(self):
          self.sc = myCanvas()
          self.l=QVBoxLayout(self.ui.frame)
          self.l.addWidget(self.sc)
          self.ui.centralwidget.setLayout(self.l)
          
      def connectSignalSlots(self):
          
          self.ui.actionShow_Plot.triggered.connect(self.Plot)
      
      def db_plot_values(self):
          self.mydb = mysql.connector.connect(host=&quot;localhost&quot;,
                              user=&quot;root&quot;,
                              password=&quot;*********&quot;,
                              database=&quot;allocation&quot;)
          self.mycursor = self.mydb.cursor()
  
          # Fecthing Data From mysql to my python progam
          self.mycursor.execute(&quot;select date, net_data from table1 where point = '5'&quot;)
          self.result = self.mycursor.fetchall
  
          date = []
          net_data = []
  
          for i in self.mycursor:
              date.append(i[0])
              net_data.append(i[1])
          
          self.x = date
          self.y = net_data
          
          
          
  
      def Plot(self):
          
          self.sc.plot(self.x,self.y)
      
  
  class myCanvas(FigureCanvas):
      def __init__(self, *args, **kwargs):    
          self.fig = Figure()
          
          super(myCanvas,self).__init__(self.fig,*args,**kwargs)
      
      def plot(self,x,y):
          self.fig.clear()
          self.ax = self.fig.add_subplot(111)
          self.ax.plot(x[1:],y[1:])
          self.draw()       
  </code></pre>
  <p>The error I get here is TypeError: <code>'builtin_function_or_method' object is not subscriptable</code></p>
  <p>I have tried removing the square brackets in the <code>def plot()</code>  function but it still does not work.</p>
  <p>I think this is because my date data is in datatime like <code>[datetime.date(2021, 3, 1), datetime.date(2021, 3, 2), datetime.date(2021, 3, 3), datetime.date(2021, 3, 4), datetime.date(2021, 3, 5), datetime.date(2021, 3, 6), datetime.date(2021, 3, 7)]</code> while the net_data is in decimal. But I have no idea how to fix it.</p>
  <p>The rest of the code is just the layout gotten from QtDesigner, that's why it isn't pasted.</p>