gpt4 book ai didi

python - 模块 'pandas' 没有属性 'tslib'

转载 作者:行者123 更新时间:2023-12-03 16:45:41 28 4
gpt4 key购买 nike

我无法使用 ggplot包在 python 中。

import pandas as pd

from ggplot import *


import pandas as pd

from ggplot import *
它返回:

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

最佳答案

我改了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 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
)

关于python - 模块 'pandas' 没有属性 'tslib',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58143253/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com