The interface between ROOT and NumPy
.. -- mode: rst --
:warning:root_numpy is deprecated and unmaintained:warning:
root_numpyhas not been actively maintained in several years. This is mostly due to the emergence of new alternatives which are both faster and more flexible.
See here for details._
directly using TTree_ or with
the newer RDataFrame_
.. image:: https://img.shields.io/pypi/v/rootnumpy.svg :target: https://pypi.python.org/pypi/rootnumpy .. image:: https://api.travis-ci.org/scikit-hep/rootnumpy.png :target: https://travis-ci.org/scikit-hep/rootnumpy .. image:: https://coveralls.io/repos/github/scikit-hep/rootnumpy/badge.svg?branch=master :target: https://coveralls.io/github/scikit-hep/rootnumpy?branch=master .. image:: https://landscape.io/github/scikit-hep/rootnumpy/master/landscape.svg?style=flat :target: https://landscape.io/github/scikit-hep/rootnumpy/master .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.592881.svg :target: https://doi.org/10.5281/zenodo.592881
[see the full documentation]_
rootnumpy is a Python extension module that provides an efficient interface between
NumPy. rootnumpy's internals are compiled C++ and can therefore handle large amounts of data much faster than equivalent pure Python implementations.
With your ROOT data in NumPy form, make use of NumPy's
broad library, including fancy indexing, slicing, broadcasting, random sampling, sorting, shape transformations, linear algebra operations, and more. See this
tutorialto get started. NumPy is the fundamental library of the scientific Python ecosystem. Using NumPy arrays opens up many new possibilities beyond what ROOT offers. Convert your TTrees into NumPy arrays and use
SciPy_ for numerical integration and optimization,
matplotlib_ for plotting,
pandas_ for data analysis,
statsmodels_ for statistical modelling,
scikit-learn_ for machine learning, and perform quick exploratory analysis in a
At the core of rootnumpy are powerful and flexible functions for converting
structured NumPy arrays_ as well as converting NumPy arrays back into ROOT TTrees. rootnumpy can convert branches of strings and basic types such as bool, int, float, double, etc. as well as variable-length and fixed-length multidimensional arrays and 1D or 2D vectors of basic types and strings. rootnumpy can also create columns in the output array that are expressions involving the TTree branches similar to
Did we mention that root_numpy is fast?
.. image:: benchmarks/bench_tree2array.png