Skip to content

BUG: Column-major DataFrames stored in HDFStore are returned as row-major #22073

Closed
@wesm

Description

@wesm

Code Sample, a copy-pastable example if possible

import pandas as pd

df = pd.DataFrame({
    'a': [1, 2, 3, 4],
    'b': ['foo', 'bar', 'baz', 'qux'],
    'c': [5, 6, 7, 8]
})

print(df['a'].values.strides)

store = pd.HDFStore('example.h5')
store['df'] = df

print(store['df']['a'].values.strides)
## -- End pasted text --
(8,)
(16,)

Problem description

I ran across this when doing some benchmarking. This has some rather serious performance implications for large DataFrames. Is this the result of an underlying limitation in HDF5?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions