Uproot

Latest version: v5.3.7

Safety actively analyzes 629723 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 27 of 55

3.4.9

Moved Event.root to an HTTP source to make the tests directory smaller.

`uproot.numentries` is now documented.

3.4.8

Deploy another one because the last already exists in PyPI (not a clean test).

3.4.7

Merge PR 235, which only adds to tests, but it required a removal of PyOpenSSL from Travis, so I need to know if it will deploy properly (the reason the PyOpenSSL update was in there).

3.4.6

Fixed 232, in which Double32 couldn't be converted to a flat Pandas DataFrame.

3.4.5

PR 226, 229, and issue 227

* loosening the definition of "compatible interpretations" across files in `uproot.iterate`
* fixed `tree.pandas.df(flatten=True)` for jagged arrays that contain lists
* corrected handling of truncated Double32

3.4.4

Faster `TTree.pandas.df(flatten=True)` provided by PR 223.

One capability that was _lost_ was reading branches with different jagged structure into the same DataFrame with `flatten=True`. For instance, a TTree containing different numbers of electrons and muons can't be simultaneously flattened. The old code managed to do this with an [outer join](https://en.wikipedia.org/wiki/Join_(SQL)#Full_outer_join) on DataFrames. We no longer do this in the `TTree.pandas.df` code; instead, we broadcast JaggedArrays, which is not just faster, it's also more correct. Does it make sense to put the first electron and the first muon in the same row, then the second electron and the second muon in another row, where the two sets have different sizes in each event? (The shorter of the two then has to be padded with `NaN`.) This joint row-membership doesn't correspond to any property the second electron and second muon share.

Now there's a ValueError warning you if you try to do this. You can encounter this error rather easily by not specifying branches—implicitly saying you want all branches from a TTree, which may contain incompatible branches. Remember that you can use glob patterns to ask for all branches satisfying a name pattern.

If you really do want to mix different cardinalities in the same DataFrame, you can explicitly do an outer join in Pandas:

python
muons = tree.pandas.df("Muon_*", flatten=True)
electrons = tree.pandas.df("Electron_*", flatten=True)
muons.join(electrons, how="outer")


You can also choose to _not_ flatten the DataFrame, which puts no constraints on the structure of the contents (but is less useful if you have a lot of jagged data).

Page 27 of 55

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.