鱼C论坛

 找回密码
 立即注册
查看: 1443|回复: 1

timestamp怎么引用不了

[复制链接]
发表于 2018-8-28 16:41:08 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
这是错误:
Warning (from warnings module):
  File "F:\python\lib\site-packages\ggplot\utils.py", line 81
    pd.tslib.Timestamp,
FutureWarning: pandas.tslib is deprecated and will be removed in a future version.
You can access Timestamp as pandas.Timestamp

Warning (from warnings module):
  File "F:\python\lib\site-packages\ggplot\stats\smoothers.py", line 4
    from pandas.lib import Timestamp
FutureWarning: The pandas.lib module is deprecated and will be removed in a future version. These are private functions and can be accessed from pandas._libs.lib instead
Traceback (most recent call last):
  File "F:\练习数据\3.py", line 12, in <module>
    import ggplot
  File "F:\python\lib\site-packages\ggplot\__init__.py", line 20, in <module>
    from .stats import stat_smooth, stat_density
  File "F:\python\lib\site-packages\ggplot\stats\__init__.py", line 2, in <module>
    from .stat_smooth import stat_smooth
  File "F:\python\lib\site-packages\ggplot\stats\stat_smooth.py", line 5, in <module>
    from . import smoothers
  File "F:\python\lib\site-packages\ggplot\stats\smoothers.py", line 4, in <module>
    from pandas.lib import Timestamp
ImportError: cannot import name 'Timestamp' from 'pandas.lib' (F:\python\lib\site-packages\pandas\lib.py)
这是代码:
import numpy as np
import scipy as sp
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
import prettyplotlib
import ggplot

mpl.style.use('seaborn-whitegrid');

def sta001(k,nyear,xd):
    d2=np.fv(k,nyear,-xd,-xd);
    d2=round(d2)
    print(nyear,d2)
    return d2

def dr_xtyp(_dat):
    xtyp=['bmh','dark_background','fivethirtyeight','ggplot','grayscale','default'];
    i=0;
    for xss in plt.style.available:
        plt.figure()
        plt.style.use(xss);
        _dat.plot()
        fss='tmp\\k101_'+xss+'.png';plt.savefig(fss);
        i+=1;
        print(i,xss,',',fss)
        plt.show()

    dx05=[sta001(0.05,x,1.4) for x in range(0,40)]
    dx10=[sta001(0.10,x,1.4) for x in range(0,40)]
    dx15=[sta001(0.15,x,1.4) for x in range(0,40)]
    dx20=[sta001(0.20,x,1.4) for x in range(0,40)]
    df=pd.DataFrame(columns=['dx05','dx10','dx15','dx20']);
    df['dx05']=dx05;df['dx10']=dx10;
    df['dx15']=dx15;df['dx20']=dx20;
    print(df.tail())

    dr_xtyp(df)
有什么问题,怎么解决
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2018-8-28 16:53:59 | 显示全部楼层
from pandas._libs import Timestamp是OK的,
里面好多软件没玩过,提示是版本不匹配的问题
可能你的ggplot版本比较老
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2026-1-1 19:19

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表