uproot.interpretation.library.Pandas

Defined in uproot.interpretation.library on line 832.

Inheritance order:

  1. uproot.interpretation.library.Library

class uproot.interpretation.library.Pandas

A uproot.interpretation.library.Library that presents TBranch data as Pandas Series and DataFrames. The standard name for this library is "pd".

The single-TBranch (with a single TLeaf) form for this library is pandas.Series, and the “group” form is pandas.DataFrame.

The “group” behavior for this library is:

  • how=None or a string: passed to pandas.merge as its how parameter, which would be relevant if jagged arrays with different multiplicity are requested.

  • how=dict: a dict of str → array, mapping the names to pandas.Series.

  • how=tuple: a tuple of pandas.Series, in the order requested. (Names are assigned to the pandas.Series.)

  • how=list: a list of pandas.Series, in the order requested. (Names are assigned to the pandas.Series.)

Pandas Series and DataFrames are indexed, so global_index adjusts them.

imported

Inherited from uproot.interpretation.library.Library.

Pandas.imported

empty

Inherited from uproot.interpretation.library.Library.

Pandas.empty(shape, dtype)
Parameters:
  • shape (tuple of int) – NumPy array shape. (The first item must be zero.)

  • dtype (numpy.dtype or its constructor argument) – NumPy array dtype.

Returns an empty NumPy-like array.

zeros

Inherited from uproot.interpretation.library.Library.

Pandas.zeros(shape, dtype)
Parameters:
  • shape (tuple of int) – NumPy array shape. (The first item must be zero.)

  • dtype (numpy.dtype or its constructor argument) – NumPy array dtype.

Returns a NumPy-like array of zeros.

finalize

Inherited from uproot.interpretation.library.Library.

Pandas.finalize(array, branch, interpretation, entry_start, entry_stop, options)
Parameters:
  • array (array) – Internal, temporary, trimmed array. If this is a NumPy array, it may be identical to the output array.

  • branch (uproot.TBranch) – The TBranch that is represented by this array.

  • interpretation (uproot.interpretation.Interpretation) – The interpretation that produced the array.

  • entry_start (int) – First entry that is included in the output.

  • entry_stop (int) – FIrst entry that is excluded (one greater than the last entry that is included) in the output.

  • interp_options (dict) – Flags and other options passed through the interpretation process.

Create a library-appropriate output array for this temporary array.

This array would represent one TBranch (i.e. not a “group”).

group

Inherited from uproot.interpretation.library.Library.

Pandas.group(arrays, expression_context, how)
Parameters:
  • arrays (dict of str → array) – Mapping from names to finalized array objets to combine into a group.

  • expression_context (list of (str, dict) tuples) – Expression strings and a dict of metadata about each.

  • how (None, str, or container type) – Library-dependent instructions for grouping. The only recognized container types are tuple, list, and dict. Note that the container type itself must be passed as how, not an instance of that type (i.e. how=tuple, not how=()).

Combine the finalized arrays into a library-appropriate group type.

global_index

Inherited from uproot.interpretation.library.Library.

Pandas.global_index(arrays, global_offset)
Parameters:
  • array (array) – The library-appropriate array whose global index needs adjustment.

  • global_offset (int) – A number to add to the global index of array to correct it.

Apply in-place corrections to the global index of array by adding global_offset.

Even though the operation is performed in-place, this method returns the array.

concatenate

Inherited from uproot.interpretation.library.Library.

Pandas.concatenate(all_arrays)
Parameters:

all_arrays (list of arrays) – A list of library-appropriate arrays that need to be concatenated.

Returns a concatenated version of all_arrays.