我无法在python中使用ggplot包。
import pandas as pd
from ggplot import *
import pandas as pd
from ggplot import *它返回:
AttributeError:模块“熊猫”没有属性“tslib”
发布于 2019-11-25 08:29:36
我在我的PC上的import源文件中更改了pandas模块的ggplot命令,它为我工作。您可以在您的错误信息中找到那些在您的PC上的位置。对我来说是C:\Users\user\Anaconda3\Lib\site-packages\ggplot
我修改过的文件:
在C:\Users\user\Anaconda3\Lib\site-packages\ggplot\utils.py中
从…
date_types = (
pd.tslib.Timestamp,
pd.DatetimeIndex,
pd.Period,
pd.PeriodIndex,
datetime.datetime,
datetime.time
)至:
date_types = (
pd._tslib.Timestamp,
pd.DatetimeIndex,
pd.Period,
pd.PeriodIndex,
datetime.datetime,
datetime.time
)在C:\Users\user\Anaconda3\Lib\site-packages\ggplot\stats\smoothers.py中,同样的变化与上面一样,另外还有:
from pandas.lib import Timestamp至:
from pandas import Timestampdate_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
)发布于 2020-08-14 10:24:47
我在实验室发现了这个问题。要解决这个问题,只需单击指向util.py、smoother.py的错误通知链接即可。
中的一些配置
然后ctrl-s保存新的配置。
然后,ctrl-s保存新的配置后,修复上述所有。再运行一次这个牢房。
发布于 2019-09-28 04:08:42
你想要的
import rpy2其中有一个问题,但至少你能让它发挥作用
我的建议是直接在R中使用ggplot2,即使正确安装了熊猫也很难让它正常工作,而且语法也不简单。
https://stackoverflow.com/questions/58143253
复制相似问题