Need help with root_numpy?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

130 Stars 52 Forks BSD 3-Clause "New" or "Revised" License 947 Commits 4 Opened issues


The interface between ROOT and NumPy

Services available


Need anything else?

Contributors list

.. -- mode: rst --

:warning:root_numpy is deprecated and unmaintained:warning:

has not been actively maintained in several years. This is mostly due to the emergence of new alternatives which are both faster and more flexible.
  • uproot provides support for reading and writing ROOT files without the need for an installation of ROOT.
    See here for details. 
  • ROOT now natively supports converting objects into numpy arrays using either
    directly using TTree 
    _ or with
    the newer RDataFrame 

root_numpy: The interface between ROOT and NumPy

.. image:: :target: .. image:: :target: .. image:: :target: .. image:: :target: .. image:: :target:

[see the full documentation] 

rootnumpy is a Python extension module that provides an efficient interface between


. 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
to 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
_ for numerical integration and optimization,
_ for plotting,
_ for data analysis,
_ for statistical modelling,
_ for machine learning, and perform quick exploratory analysis in a
Jupyter notebook 

At the core of rootnumpy are powerful and flexible functions for converting

ROOT TTrees 

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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.