Pandas dataframe to and from HDF file -> C-Contiguous?

30 views
Skip to first unread message

Jonas Baumann

unread,
Nov 7, 2018, 9:12:56 AM11/7/18
to PyData
Hallo,
Recently after playing with pandas dataframe and HDF5 files, I discovered that after storing a dataframe and then reading it, the columns became non-contiguous. Like:
```
>>> df = pd.DataFrame({"a":[1,2,3], "b":[4,5,6]})
>>> df["a"].values.flags
  C_CONTIGUOUS : True
  F_CONTIGUOUS : True

>>> df.to_hdf("test.h5", "all")
>>> df1 = pd.read_hdf("test.h5", "all")
>>> df1["a"].values.flags
  C_CONTIGUOUS : False
  F_CONTIGUOUS : False
```

I am wondering if I missed some configure option or done anything wrong, any help would be appreciated. Thanks!

Reply all
Reply to author
Forward
0 new messages