title: mplfinance KeyError: 'Open'
body: <p>I'm trying to create OHLC charts from tick data using <em>mplfinance</em> from a <em>pandas</em> dataframe. The original data is stored in a database containing <code>date</code> (fecha), <code>time</code> (hora) and <code>last</code>, so, before tryging to create the chart I have to resample to OHLC.</p>
  
  <pre><code>cur = conn.cursor()
  nameddict=({"ticker": "GFGC90.0JU"})
  select="""SELECT 
      EXTRACT(EPOCH FROM (fecha || ' ' || hora)::timestamp) as datetime, last from preciosrt
      where ticker=%(ticker)s and last is not null 
      """
  df = pandas.read_sql_query(select, conn, params=nameddict)
  df['datetime'] = pandas.to_datetime(df['datetime'], unit='s')
  df = df.set_index('datetime')
  ohlc = df.resample('5Min').ohlc()
  print(ohlc)
  mpf.plot(ohlc)
  </code></pre>
  
  <p>As you can see, the resulting dataframe contains the desired result:</p>
  
  <pre><code>                     last                   
                       open  high   low  close
  datetime                                    
  2020-05-04 16:15:00  5.10  5.10  5.10  5.100
  2020-05-04 16:20:00  5.14  5.14  5.02  5.140
  2020-05-04 16:25:00  5.00  5.25  5.00  5.249
  2020-05-04 16:30:00  5.29  5.45  5.29  5.450
  2020-05-04 16:35:00  5.45  5.50  5.30  5.300
  2020-05-04 16:40:00  5.21  5.30  5.20  5.200
  2020-05-04 16:45:00  5.20  5.30  5.20  5.200
  2020-05-04 16:50:00  5.21  5.30  5.21  5.260
  2020-05-04 16:55:00  5.26  5.33  5.10  5.100
  </code></pre>
  
  <p>But, when I try to plot the chart using <code>mpf.plot(ohlc)</code> I get this error:</p>
  
  <pre><code>...
  
  ~/.local/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
     2646                 return self._engine.get_loc(key)
     2647             except KeyError:
  -&gt; 2648                 return self._engine.get_loc(self._maybe_cast_indexer(key))
     2649         indexer = self.get_indexer([key], method=method, tolerance=tolerance)
     2650         if indexer.ndim &gt; 1 or indexer.size &gt; 1:
  
  pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
  
  pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
  
  pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
  
  pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
  
  KeyError: 'Open'
  </code></pre>
  
  <p>How can I solve this?.</p>