用mplfinance调用本地csv绘制K线图,可以调出数据,但调用plot绘图就报错,是什么原因呢?



import pandas as pd
import mplfinance as mpf
daily = pd.read_csv('D:\文档\price2.csv',encoding='gb18030')
daily = daily.loc[:,['tradeDate','openPrice','highestPrice','lowestPrice','closePrice','turnoverVol']]
daily.rename(
    columns={'tradeDate':'Date', 'openPrice':'Open', 'highestPrice':'High', 'lowestPrice':'Low', 'closePrice':'Closes', 'turnoverVol':'Volume'},inplace=True
)
daily = daily.iloc[::1]
daily['Date']=pd.to_datetime(daily['Date'])
daily.set_index(['Date'],inplace=True)
print(daily)
s = mpf.make_mpf_style(
    base_mpf_style = 'binance',
    rc = {'font.family':'SimHei'}#设置中文字体
)
mpf.plot(daily,
         title='股票',
         style=s,
         type='candle',
         ylabel='元/每股',
         volume=False,
         show_nontrading=True,  # 是否跳过非交易日
         ylabel_lower='成交量',
         mav=(2, 5, 10),
         )
mpf.show()
"""
报错

Traceback (most recent call last):
  File "C:\Users\zzj13\AppData\Roaming\Python\Python39\site-packages\pandas\core\indexes\base.py", line 3361, in get_loc
    return self._engine.get_loc(casted_key)
  File "pandas\_libs\index.pyx", line 76, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\index.pyx", line 108, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\hashtable_class_helper.pxi", line 5198, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas\_libs\hashtable_class_helper.pxi", line 5206, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Close'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\PYTHONSTUDY\量化分析\行情数据.py", line 18, in <module>
    mpf.plot(daily,
  File "C:\Users\zzj13\AppData\Roaming\Python\Python39\site-packages\mplfinance\plotting.py", line 298, in plot
    dates,opens,highs,lows,closes,volumes = _check_and_prepare_data(data, config)
  File "C:\Users\zzj13\AppData\Roaming\Python\Python39\site-packages\mplfinance\_arg_validators.py", line 66, in _check_and_prepare_data
    closes  = data[c].values
  File "C:\Users\zzj13\AppData\Roaming\Python\Python39\site-packages\pandas\core\frame.py", line 3458, in __getitem__
    indexer = self.columns.get_loc(key)
  File "C:\Users\zzj13\AppData\Roaming\Python\Python39\site-packages\pandas\core\indexes\base.py", line 3363, in get_loc
    raise KeyError(key) from err
KeyError: 'Close'
"""

第八行 Closes写错了吧,改成Close试试