栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

数据可视化——安装ggplot

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

数据可视化——安装ggplot

首先

pip install ggplot

因为新安装的版本比较高,原来的没有维护了,所以需要修改一些配置
我这里pycharm的运行环境是Python,所以安装ggplot时,会安装在Python下,如果选择的运行环境是anaconda,ggplot在anaconda下
第一个问题

AttributeError: module 'pandas' has no attribute 'tslib'

解决方法
pythonlocationLibsite-packagesggplotutils.py

date_types = (
    pd.tslib.Timestamp,
    pd.DatetimeIndex,
    pd.Period,
    pd.PeriodIndex,
    datetime.datetime,
    datetime.time
)

改为

date_types = (
    pd.Timestamp,
    pd.DatetimeIndex,
    pd.Period,
    pd.PeriodIndex,
    datetime.datetime,
    datetime.time
)

第二个问题

ModuleNotFoundError: No module named 'pandas.lib'

解决方法
pythonlocationLibsite-packagesggplotstatssmoothers.py

from pandas.lib import Timestamp

改为

from pandas import Timestamp

然后

date_types = (
     pd.tslib.Timestamp ,
    pd.DatetimeIndex,
    pd.Period,
    pd.PeriodIndex,
    datetime.datetime,
    datetime.time
)

改为

date_types = (
    pd.Timestamp,
    pd.DatetimeIndex,
    pd.Period,
    pd.PeriodIndex,
    datetime.datetime,
    datetime.time
)

第三个问题

'Dataframe' object has no attribute 'sort'

解决方法
pythonlocationLibsite-packagesggplotstatsstat_smooth.py

smoothed_data = smoothed_data.sort('x') 

改为

smoothed_data = smoothed_data.sort_values('x')

pythonlocationLibsite-packagesggplotggplot.py

fill_levels = self.data[[fillcol_raw, fillcol]].sort(=fillcol_raw)[fillcol].unique() 

改为

fill_levels = self.data[[fillcol_raw, fillcol]].sort_values(by=fillcol_raw)[fillcol].unique()
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/444873.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号