python - 模块“熊猫”没有属性“tslib”
问题描述
我无法ggplot
在 python 中使用包。
import pandas as pd
from ggplot import *
import pandas as pd
from ggplot import *
它返回:
AttributeError:模块“熊猫”没有属性“tslib”
解决方案
我更改了 PC 上源文件中模块的import
命令,它对我有用。您可以在错误消息中找到您 PC 上的位置。对我来说,这是
我更改的文件:
In
Frompandas
ggplot
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
)
推荐阅读
- javascript - 如何将 jsdoc 添加到 jquery $.each() 函数中?
- python - Django将model.class传入查看
- asp.net - 更新默认 AspNetUsers 数据库表中的自定义列数据
- reactjs - 使用事件对象访问 ReactJs 中的 html 节点是一种好习惯吗?
- c++ - constexpr 构造函数可以使用成员的地址(GCC+MSVC vs Clang)初始化基类吗?
- asp.net - 将 wordpress 博客与 asp.net 网站集成
- ffmpeg - I have a file in the .sec path, when I convert it to mp4 or avi format with ffmpeg, the video comes out very fast
- visual-studio-code - 尽管“terminal.integrated.defaultProfile.windows”设置为“命令提示符”,但更新后的 VS Code 在终端中提供了 PowerShell
- c# - 如何使用 lerp 命令使对象仅从右侧旋转?
- sql - 计算具有重叠周期的值