datreant / datreant.data

convenient data storage and retrieval in HDF5 for Treants
http://datreant.org/
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

do a groupby/filter on data keys #20

Open kain88-de opened 7 years ago

kain88-de commented 7 years ago

I have a treant with a lot of data entries called run-* and some others with different names. To get only the one with run-* I currently have to create a list with the keys I like and then iterate over the list of keys.

run_data = (k for k in t.data.keys() if k.startswith('run-'))
for k in run_data:
    data = t.data[k]
    pass

It would be more convenient if I could do

for data in t.data['run-*']:
    pass

I'm not to sure about the syntax here though. It would also mean we allow general regex in the getitem method. But also keep in mind that in over a year of using the library this is the first time I wanted to do something like this.