python ggplot库 画图报错

1、问题:已经在cmd下使用"pip install ggplot"成功安装了ggplot包,在IDLE以及Jupyter Notebook下使用
“from ggplot import *”语句导入ggplot包时报错:ImportError: cannot import name ‘Timestamp’
解决方案:请找到文件 ⋯/site-packages/ggplot/stats/smoothers.py
并且做以下修改:from pandas.lib import Timestamp1改成from pandas import Timestamp

2、问题:AttributeError: ‘DataFrame’ object has no attribute ‘sort’
解决方案:
第一、在E:/Anaconda3/Lib/site-packages/ggplot/stats/stat_smooth.py(当然这应该是ggplot包的位置)下改变77行: smoothed_data = smoothed_data.sort(‘x’)
改变为: smoothed_data = smoothed_data.sort_values(‘x’)

在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_39008205/article/details/89420029