DataSource调用read_df出错


(fingertap) #1

这段代码会报错,不太懂为啥文档里说实现了DataSourceDataFrame的自动转化,实际却不行。最小复现代码:

m = M.instruments.v2(
    start_date='2015-01-01',
    end_date='2017-12-31',
    market='CN_STOCK_A'
)
df = m.data.read_df()

错误信息:

HDF5ExtError                              Traceback (most recent call last)
HDF5ExtError: HDF5 error back trace

  File "H5F.c", line 511, in H5Fopen
    unable to open file
  File "H5Fint.c", line 1604, in H5F_open
    unable to read superblock
  File "H5Fsuper.c", line 413, in H5F__super_read
    file signature not found

End of HDF5 error back trace

Unable to open/create file '/var/app/data/bigquant/datasource/user/v3/5/8d/xxxxxxxxx'

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
<ipython-input-4-6830599860c5> in <module>()
      4     market=market
      5 )
----> 6 df = m.data.read_df()

OSError: HDF5 error back trace

  File "H5F.c", line 511, in H5Fopen
    unable to open file
  File "H5Fint.c", line 1604, in H5F_open
    unable to read superblock
  File "H5Fsuper.c", line 413, in H5F__super_read
    file signature not found

End of HDF5 error back trace

Unable to open/create file '/var/app/data/bigquant/datasource/user/v3/5/8d/xxxxxxxxxxx'

看了一下,m.read()输出结果是正常的,手动转成DataFrame也是可以的:

import pandas as pd
pd.DataFrame(m.read()).head()

输出:
image


(达达) #2

目前平台数据缓存分两种,DataFrame类数据可通过.read_df()读取,其他的列表、字典、模型等通过.read_pickle()读取,可统一使用.read读取


(fingertap) #3

OK,DataSource可以封装多种kv对象,谢谢。


(user4310) #4

datasorce write的数据有存在时间限制吗,到期自动释放?