def root2pandas(file_name):
    with rootpy.io.root_open(file_name, "READ") as root_file:
        for path, dirs, objects in root_file.walk():
            for objName in objects:
                obj = root_file.Get(path + "/" + objName)
                if isinstance(obj, rootpy.tree.Tree):
                    print("Adding a tree named " + objName + " from file " + file_name)
                    tree = obj
                    numpy_array = tree.to_array()
                    dataframe = pandas.DataFrame(numpy_array)
                    print("success, features:", len(dataframe.columns), "events", len(dataframe))
                    return dataframe
    raise RuntimeError("Nothing found in the file {}".format(file_name))
Override the default cache timeout.
dataset/ETHPy150Open anaderi/lhcb_trigger_ml/hep_ml/rootutilities.py/root2pandas--crossover with--dataset/ETHPy150Open livid/v2ex/twitter/twitter.py/Api.SetCacheTimeout