Matplotlib created a temporary config/cache directory at C:\Users\Elegent\AppData\Local\Temp\matplotlib-pyrb807h because the default path (C:\Users\Elegent\.matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing. Traceback (most recent call last): File "D:\pythonProject\AppleStock\ananly2.py", line 24, in <module> candlestick_ochl(ax, df[["Open", "Close", "Volume", "High", "Low"]].values, width=0.5, colorup="green", colordown="red") File "D:\pythonProject\venv\lib\site-packages\mplfinance\original_flavor.py", line 195, in candlestick_ochl return _candlestick(ax, quotes, width=width, colorup=colorup, File "D:\pythonProject\venv\lib\site-packages\mplfinance\original_flavor.py", line 286, in _candlestick if close >= open: TypeError: '>=' not supported between instances of 'int' and 'str'
时间: 2023-07-03 12:28:15 浏览: 230
这个错误可能是由于您的数据类型不匹配所导致的。您可以尝试将 Close、Open、High 和 Low 这些列的数据类型转换为 float 或者 int 类型。您可以使用以下代码进行转换:
```python
df['Close'] = df['Close'].astype(float)
df['Open'] = df['Open'].astype(float)
df['High'] = df['High'].astype(float)
df['Low'] = df['Low'].astype(float)
```
如果您还遇到了 "MPLCONFIGDIR environment variable not set" 的错误,您可以在代码的开头添加以下代码来设置 MPLCONFIGDIR 环境变量:
```python
import os
os.environ['MPLCONFIGDIR'] = '/tmp/'
```
这样就可以避免上述警告,同时可以加速 Matplotlib 的导入并提高多进程支持。
相关问题
/environment/miniconda3/lib/python3.7/site-packages/matplotlib/mpl-data/fonts/ttf/SimHei.ttf: No such file or directory
这个错误提示表明SimHei.ttf字体文件不存在于指定的目录中。可能是因为你没有正确地下载和安装该字体文件,或者是因为你的路径设置不正确。你可以按照以下步骤检查和解决该问题:
1. 确认你已经正确地下载了SimHei.ttf字体文件,并将其放置在指定的目录下。
2. 检查你的路径设置是否正确,特别是确认你的路径中是否包含了正确的用户名和文件夹名称。
3. 确认你已经正确地修改了matplotlibrc文件,并将SimHei字体添加到了font.sans-serif列表中。
4. 检查你的缓存文件是否已经被正确地删除。
5. 确认你已经正确地重新启动了jupyter,并且已经执行了_rebuild()函数来重新加载字体。
如果你仍然遇到问题,可以尝试重新安装matplotlib或者在matplotlib的官方文档中查找更多的解决方案。
Requirement already satisfied: matplotlib in c:\users\tangtang\appdata\local\programs\python\python35-32\lib\site-packages (3.0.3)
根据您提供的引用内容,您想知道关于"matplotlib"包的信息。根据和引用,通过使用命令"pip install --target=xxx matplotlib"或"pip install --target=I:\APP测试\frida\objection matplotlib"可以在指定的路径安装matplotlib包。根据引用,如果您已经安装了matplotlib包,则会显示"Requirement already satisfied"。根据引用中的路径,我们可以看到您安装的matplotlib版本为3.0.3,并且安装在"c:\users\tangtang\appdata\local\programs\python\python35-32\lib\site-packages"目录下。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)