Skip to content

Improve of design of filtering of branches when concatenating #1388

Open
@acampove

Description

@acampove

I am using version 5.5.2 and in the snippet below:

import uproot
import numpy as np

def _make_file(fname : str):
    n_entries = 10
    branch1_data = np.random.rand(n_entries)
    branch2_data = np.random.rand(n_entries)

    with uproot.recreate(fname) as f:
        f["tree"] = {
            "a_1": branch1_data,
            "a_2": branch2_data,
            "a_3": branch1_data,
            "a_4": branch2_data,  
            "b_1": branch1_data,
            "b_2": branch2_data,  
            "b_3": branch1_data,
            "b_4": branch2_data,  
        }

def main():
    _make_file('file_1.root')
    _make_file('file_2.root')

    df = uproot.concatenate({'file_1.root': 'tree', 'file_2.root' : 'tree'}, expressions={'a_1', 'a_2'}, filter_name='b*', library='pd')
    print(df)

if __name__ == "__main__":
    main()

I get columns a_1 and a_2.

From the user's POV, I want both the b and the a columns. Is it possible to modify the behavior of uproot to get an inclusive, rather than exclusive selection?

Metadata

Metadata

Assignees

Labels

featureNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions