2

我正面临这种奇怪的行为,我得到了一个包含 DataFrames 的 HDFStore。对于 store 中的 2 个键,形状信息因查询方式而异。例子:

In [1]: mystore = pandas.HDFStore('/store')
In [2]: mystore
Out[2]: 
<class 'pandas.io.pytables.HDFStore'>
File path: /store
/chunk_data                frame        (shape->[1,1])  
/enrich_data_kb            frame        (shape->[1,11]) 
/inputs                    frame        (shape->[105,4])
/prepare_data              frame        (shape->[105,7])
/reduce_data               frame        (shape->[18,4]) 

In [3]: mystore['chunk_data'].shape
Out[3]: (0, 1)

In [4]: mystore['enrich_data_kb'].shape
Out[4]: (18, 11)

In [5]: mystore['inputs'].shape
Out[5]: (105, 4)

任何想法 ?

正如 Jeff 建议的那样,这是 ptdump 的结果(仅限于enrich_data_kb 键):

/enrich_data_kb (Group) ''
  /enrich_data_kb._v_attrs (AttributeSet), 13 attributes:
   [CLASS := 'GROUP',
    TITLE := '',
    VERSION := '1.0',
    axis0_variety := 'regular',
    axis1_variety := 'regular',
    block0_items_variety := 'regular',
    block1_items_variety := 'regular',
    block2_items_variety := 'regular',
    encoding := None,
    nblocks := 3,
    ndim := 2,
    pandas_type := 'frame',
    pandas_version := '0.15.2']
/enrich_data_kb/axis0 (Array(11,)) ''
  atom := StringAtom(itemsize=10, shape=(), dflt='')
  maindim := 0
  flavor := 'numpy'
  byteorder := 'irrelevant'
  chunkshape := None
  /enrich_data_kb/axis0._v_attrs (AttributeSet), 7 attributes:
   [CLASS := 'ARRAY',
    FLAVOR := 'numpy',
    TITLE := '',
    VERSION := '2.4',
    kind := 'string',
    name := None,
    transposed := True]
/enrich_data_kb/axis1 (Array(18,)) ''
  atom := Int64Atom(shape=(), dflt=0)
  maindim := 0
  flavor := 'numpy'
  byteorder := 'little'
  chunkshape := None
  /enrich_data_kb/axis1._v_attrs (AttributeSet), 7 attributes:
   [CLASS := 'ARRAY',
    FLAVOR := 'numpy',
    TITLE := '',
    VERSION := '2.4',
    kind := 'integer',
    name := None,
    transposed := True]
/enrich_data_kb/block0_items (Array(8,)) ''
  atom := StringAtom(itemsize=10, shape=(), dflt='')
  maindim := 0
  flavor := 'numpy'
  byteorder := 'irrelevant'
  chunkshape := None
  /enrich_data_kb/block0_items._v_attrs (AttributeSet), 8 attributes:
   [CLASS := 'ARRAY',
    FLAVOR := 'numpy',
    TITLE := '',
    VERSION := '2.4',
    freq := None,
    kind := 'string',
    name := None,
    transposed := True]
/enrich_data_kb/block0_values (VLArray(1,)) ''
  atom = ObjectAtom()
  byteorder = 'irrelevant'
  nrows = 1
  flavor = 'numpy'
  /enrich_data_kb/block0_values._v_attrs (AttributeSet), 5 attributes:
   [CLASS := 'VLARRAY',
    PSEUDOATOM := 'object',
    TITLE := '',
    VERSION := '1.4',
    transposed := True]
/enrich_data_kb/block1_items (Array(2,)) ''
  atom := StringAtom(itemsize=10, shape=(), dflt='')
  maindim := 0
  flavor := 'numpy'
  byteorder := 'irrelevant'
  chunkshape := None
  /enrich_data_kb/block1_items._v_attrs (AttributeSet), 8 attributes:
   [CLASS := 'ARRAY',
    FLAVOR := 'numpy',
    TITLE := '',
    VERSION := '2.4',
    freq := None,
    kind := 'string',
    name := None,
    transposed := True]
/enrich_data_kb/block1_values (Array(18, 2)) ''
  atom := Float64Atom(shape=(), dflt=0.0)
  maindim := 0
  flavor := 'numpy'
  byteorder := 'little'
  chunkshape := None
  /enrich_data_kb/block1_values._v_attrs (AttributeSet), 5 attributes:
   [CLASS := 'ARRAY',
    FLAVOR := 'numpy',
    TITLE := '',
    VERSION := '2.4',
    transposed := True]
/enrich_data_kb/block2_items (Array(1,)) ''
  atom := StringAtom(itemsize=8, shape=(), dflt='')
  maindim := 0
  flavor := 'numpy'
  byteorder := 'irrelevant'
  chunkshape := None
  /enrich_data_kb/block2_items._v_attrs (AttributeSet), 8 attributes:
   [CLASS := 'ARRAY',
    FLAVOR := 'numpy',
    TITLE := '',
    VERSION := '2.4',
    freq := None,
    kind := 'string',
    name := None,
    transposed := True]
/enrich_data_kb/block2_values (Array(18, 1)) ''
  atom := Int64Atom(shape=(), dflt=0)
  maindim := 0
  flavor := 'numpy'
  byteorder := 'little'
  chunkshape := None
  /enrich_data_kb/block2_values._v_attrs (AttributeSet), 5 attributes:
   [CLASS := 'ARRAY',
    FLAVOR := 'numpy',
    TITLE := '',
    VERSION := '2.4',
    transposed := True]
4

0 回答 0