question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(group) order not preserved

See original GitHub issue

When inserting data into an h5py file object, the order is not preserved. The items (here: groups) are rather ordered alphabetically:

import h5py

with h5py.File("out.h5", "w") as f:
    a = f.create_group("b")
    b = f.create_group("a")


with h5py.File("out.h5", "r") as f:
    print(f.keys())

Output:

<KeysViewHDF5 ['a', 'b']>

Expected output:

<KeysViewHDF5 ['b', 'a']>

I don’t know if this is a property of HDF5, a problem of the reader. or a problem of the writer.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
vasolecommented, Aug 14, 2020

Hi guys, track_order works for me if instead of writing f.keys() I write f[“/”].keys()

2reactions
takluyvercommented, Jan 21, 2020

So it does. @aparamon, can you take a look? I can reproduce it with 1.10.4.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Pandas: Is Order Preserved When Using groupby() ...
See this enhancement issue. The short answer is yes, the groupby will preserve the orderings as passed in. You can prove this by...
Read more >
SQL Preserve the Order in group by
If you do not specify an order by for the result set of your first query then your data is not guaranteed to...
Read more >
Solved: preserve order when using Table.Group
As documented, Table.Group "cannot guarantee to return a fixed order of rows". While this is bad for sorted data when used with Text....
Read more >
Group by preserving the order
I have to group by preserving the order. with t as ( select 1 as col1, 5 as col2, 1 as col3 from...
Read more >
Group by: split-apply-combine
For Python 3.5 and earlier, the order of **kwargs in a functions was not preserved. This means that the output column ordering would...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found