Array Programming with NumPy



Array programming offers a extremely fine, compact and expressive syntax for having access to, manipulating and dealing on recordsdata in vectors, matrices and better-dimensional arrays. NumPy is the first array programming library for the Python language. It has an wanted purpose in examine prognosis pipelines in fields as diverse as physics, chemistry, astronomy, geoscience, biology, psychology, materials science, engineering, finance and economics. As an illustration, in astronomy, NumPy became an indispensable half of the plot stack ancient within the discovery of gravitational waves1 and within the first imaging of a black gap2. Right here we evaluation how a pair of fundamental array ideas lead to a easy and extremely fine programming paradigm for organizing, exploring and analysing scientific recordsdata. NumPy is the muse upon which the scientific Python ecosystem is constructed. It’s miles so pervasive that diverse initiatives, concentrated on audiences with if fact be told expert wants, possess developed their very accept as true with NumPy-treasure interfaces and array objects. Owing to its central dwelling within the ecosystem, NumPy more and more acts as an interoperability layer between such array computation libraries and, in conjunction with its application programming interface (API), offers a versatile framework to enhance the next decade of scientific and industrial prognosis.


Two Python array packages existed before NumPy. The Numeric kit became developed within the mid-1990s and offered array objects and array-mindful functions in Python. It became written in C and linked to associated old swiftly implementations of linear algebra3,4. One of its earliest makes use of became to handbook C++ functions for inertial confinement fusion examine at Lawrence Livermore National Laboratory5. To take care of tall large pictures coming from the Hubble Effect Telescope, a reimplementation of Numeric, called Numarray, added enhance for structured arrays, versatile indexing, memory mapping, byte-say variants, more ambiance generous memory use, versatile IEEE 754-associated old error-facing capabilities, and better form-casting solutions6. Even supposing Numarray became extremely compatible with Numeric, the 2 packages had sufficient variations that it divided the crew; on the other hand, in 2005 NumPy emerged as a ‘better of both worlds’ unification7—combining the parts of Numarray with the small-array efficiency of Numeric and its wealthy C API.

Now, 15 years later, NumPy underpins nearly every Python library that does scientific or numerical computation8,9,10,11, including SciPy12, Matplotlib13, pandas14, scikit-learn15 and scikit-image16. NumPy is a crew-developed, originate-source library, which offers a multidimensional Python array object in conjunction with array-mindful functions that operate on it. Because of its inherent simplicity, the NumPy array is the de facto change layout for array recordsdata in Python.

NumPy operates on in-memory arrays the usage of the central processing unit (CPU). To yelp contemporary, if fact be told expert storage and hardware, there became a contemporary proliferation of Python array packages. Unlike with the Numarray–Numeric divide, it is now powerful more difficult for these sleek libraries to break the user crew—given how powerful work is already built on high of NumPy. On the other hand, to present the crew with catch admission to to sleek and exploratory applied sciences, NumPy is transitioning into a central coordinating mechanism that specifies a well outlined array programming API and dispatches it, as acceptable, to if fact be told expert array implementations.

NumPy arrays

The NumPy array is a recordsdata structure that successfully stores and accesses multidimensional arrays17 (generally identified as tensors), and permits a wide diversity of scientific computation. It consists of a pointer to memory, in conjunction with metadata ancient to clarify the recordsdata saved there, notably ‘recordsdata form’, ‘shape’ and ‘strides’ (Fig. 1a).

Fig. 1: The NumPy array accommodates diverse fundamental array ideas.

a, The NumPy array recordsdata structure and its associated metadata fields. b, Indexing an array with slices and steps. These operations return a ‘behold’ of the distinctive recordsdata. c, Indexing an array with masks, scalar coordinates or diverse arrays, so that it returns a ‘replica’ of the distinctive recordsdata. In the bottom instance, an array is indexed with diverse arrays; this declares the indexing arguments before performing the lookup. d, Vectorization successfully applies operations to teams of parts. e, Broadcasting within the multiplication of two-dimensional arrays. f, Reduction operations act along diverse axes. On this situation, an array is summed along shield shut axes to set up a vector, or along two axes consecutively to set up a scalar. g, Example NumPy code, illustrating different these ideas.

The solutions form describes the personality of parts saved in an array. An array has a single recordsdata form, and each facet of an array occupies the associated likelihood of bytes in memory. Examples of knowledge forms consist of true and refined numbers (of lower and better precision), strings, timestamps and pointers to Python objects.

The form of an array determines the likelihood of parts along every axis, and the likelihood of axes is the dimensionality of the array. As an illustration, a vector of numbers could per chance perchance perchance also also be saved as a one-dimensional array of shape N, whereas color movies are four-dimensional arrays of shape (TMN, 3).

Strides are indispensable to clarify computer memory, which stores parts linearly, as multidimensional arrays. They describe the likelihood of bytes to transfer ahead in memory to bounce from row to row, column to column, and so forth. Procure into consideration, to illustrate, a two-dimensional array of floating-level numbers with shape (4, 3), the save every facet occupies 8 bytes in memory. To transfer between consecutive columns, we possess to bounce ahead 8 bytes in memory, and to catch admission to the next row, 3 × 8 = 24 bytes. The strides of that array are attributable to this fact (24, 8). NumPy can retailer arrays in both C or Fortran memory say, iterating first over both rows or columns. This permits external libraries written in these languages to catch admission to NumPy array recordsdata in memory straight.

Customers work in conjunction with NumPy arrays the usage of ‘indexing’ (to catch admission to subarrays or particular person parts), ‘operators’ (to illustrate, +, − and × for vectorized operations and @ for matrix multiplication), to boot as ‘array-mindful functions’; together, these present an easily readable, expressive, high-stage API for array programming while NumPy offers with the underlying mechanics of making operations swiftly.

Indexing an array returns single parts, subarrays or parts that fulfill a particular situation (Fig. 1b). Arrays could per chance perchance even be indexed the usage of diverse arrays (Fig. 1c). Wherever imaginable, indexing that retrieves a subarray returns a ‘behold’ on the distinctive array such that recordsdata are shared between the 2 arrays. This offers a extremely fine technique to operate on subsets of array recordsdata while limiting memory usage.

To complement the array syntax, NumPy involves functions that set up vectorized calculations on arrays, including arithmetic, statistics and trigonometry (Fig. 1d). Vectorization—working on entire arrays moderately than their particular person parts—is wanted to array programming. This implies that operations that will purchase many tens of traces to say in languages equivalent to C can generally be applied as a single, certain Python expression. This ends in concise code and frees customers to house the indispensable points of their prognosis, while NumPy handles looping over array parts shut to-optimally—to illustrate, taking strides into consideration to very most realistic yelp the computer’s swiftly cache memory.

When performing a vectorized operation (equivalent to addition) on two arrays with the associated shape, it is evident what can possess to easy occur. Through ‘broadcasting’ NumPy permits the scale to vary, and produces results that allure to intuition. A trivial instance is the addition of a scalar impress to an array, but broadcasting also generalizes to more advanced examples equivalent to scaling every column of an array or generating a grid of coordinates. In broadcasting, one or both arrays are only about duplicated (that is, with out copying any recordsdata in memory), so that the shapes of the operands match (Fig. 1d). Broadcasting is also applied when an array is indexed the usage of arrays of indices (Fig. 1c).

Various array-mindful functions, equivalent to sum, indicate and most, set up facet-by-facet ‘reductions’, aggregating results across one, more than one or all axes of a single array. As an illustration, summing an n-dimensional array over d axes ends in an array of dimension n − d (Fig. 1f).

NumPy also involves array-mindful functions for creating, reshaping, concatenating and padding arrays; browsing, sorting and counting recordsdata; and discovering out and writing recordsdata. It offers extensive enhance for generating pseudorandom numbers, involves an assortment of likelihood distributions, and performs accelerated linear algebra, the usage of 1 in every of diverse backends equivalent to OpenBLAS18,19 or Intel MKL optimized for the CPUs at hand (explore Supplementary Methods for more indispensable points).

Altogether, the mix of a easy in-memory array representation, a syntax that carefully mimics arithmetic, and a diversity of array-mindful utility functions forms a productive and powerfully expressive array programming language.

Scientific Python ecosystem

Python is an originate-source, traditional-motive interpreted programming language treasure minded to associated old programming projects equivalent to cleansing recordsdata, interacting with web resources and parsing text. Including swiftly array operations and linear algebra permits scientists to cease all their work within a single programming language—one which has the advantage of being famously easy to learn and educate, as witnessed by its adoption as a predominant discovering out language in many universities.

Even supposing NumPy isn’t very half of Python’s associated old library, it advantages from a factual relationship with the Python developers. Over the years, the Python language has added sleek parts and particular syntax so that NumPy would possess a more succinct and more straightforward-to-learn array notation. On the other hand, because it is not half of the conventional library, NumPy is animated to dictate its accept as true with commence insurance policies and pattern patterns.

SciPy and Matplotlib are tightly coupled with NumPy by historical past, pattern and use. SciPy offers fundamental algorithms for scientific computing, including mathematical, scientific and engineering routines. Matplotlib generates e-newsletter-ready figures and visualizations. The mix of NumPy, SciPy and Matplotlib, in conjunction with an developed interactive ambiance equivalent to IPython20 or Jupyter21, offers a proper foundation for array programming in Python. The scientific Python ecosystem (Fig. 2) builds on high of this foundation to present diverse, broadly ancient methodology-say libraries15,16,22, that in flip underlie different arena-say initiatives23,24,25,26,27,28. NumPy, at the erroneous of the ecosystem of array-mindful libraries, objects documentation standards, offers array checking out infrastructure and adds set up enhance for Fortran and diverse compilers.

Fig. 2: NumPy is the erroneous of the scientific Python ecosystem.

Predominant libraries and initiatives that count on NumPy’s API accomplish catch admission to to sleek array implementations that enhance NumPy’s array protocols (Fig. 3).

Many examine teams possess designed tall, advanced scientific libraries that add application-say functionality to the ecosystem. As an illustration, the eht-imaging library29, developed by the Match Horizon Telescope collaboration for radio interferometry imaging, prognosis and simulation, depends on many lower-stage parts of the scientific Python ecosystem. In explicit, the EHT collaboration ancient this library for the first imaging of a black gap. Within eht-imaging, NumPy arrays are ancient to retailer and manipulate numerical recordsdata at every step within the processing chain: from raw recordsdata thru calibration and image reconstruction. SciPy offers tools for traditional image-processing projects equivalent to filtering and image alignment, and scikit-image, a image-processing library that extends SciPy, offers better-stage functionality equivalent to edge filters and Hough transforms. The ‘scipy.optimize’ module performs mathematical optimization. NetworkX22, a kit for advanced network prognosis, is ancient to substantiate image comparison consistency. Astropy23,24 handles associated old large file codecs and computes time–coordinate transformations. Matplotlib is ancient to visualize recordsdata and to generate the final image of the black gap.

The interactive ambiance created by the array programming foundation and the surrounding ecosystem of tools—internal of IPython or Jupyter—is good to exploratory recordsdata prognosis. Customers can fluidly peep, manipulate and visualize their recordsdata, and all at as soon as iterate to refine programming statements. These statements are then stitched together into imperative or handy packages, or notebooks containing both computation and yarn. Scientific computing beyond exploratory work is regularly done in a text editor or an integrated pattern ambiance (IDE) equivalent to Spyder. This wealthy and productive ambiance has made Python sleek for scientific examine.

To complement this facility for exploratory work and like a flash prototyping, NumPy has developed a culture of the usage of time-tested plot engineering practices to toughen collaboration and lower error30. This culture isn’t very handiest adopted by leaders within the mission but also enthusiastically taught to inexperienced persons. The NumPy crew became early to undertake distributed revision management and code evaluation to toughen collaboration on code, and proper checking out that runs an intensive battery of computerized assessments for every proposed change to NumPy. The mission also has entire, high positive documentation, integrated with the source code31,32,33.

This culture of the usage of very most realistic practices for producing respectable scientific plot has been adopted by the ecosystem of libraries that set up on NumPy. As an illustration, in a contemporary award given by the Royal Mammoth Society to Astropy, they voice: “The Astropy Mission has offered a entire bunch of junior scientists with journey in official-associated old plot pattern practices including use of version management, unit checking out, code evaluation and self-discipline monitoring procedures. Right here is a crucial ability jam for up-to-the-minute researchers that is regularly missing from formal college education in physics or astronomy”34. Community individuals explicitly work to take care of this lack of formal education thru packages and workshops35,36,37.

The sizzling like a flash increase of knowledge science, machine discovering out and synthetic intelligence has extra and dramatically boosted the scientific use of Python. Examples of its indispensable functions, such because the eht-imaging library, now exist in nearly every self-discipline within the natural and social sciences. These tools possess change into the first plot ambiance in many fields. NumPy and its ecosystem are regularly taught in college packages, boot camps and summer colleges, and are the focus of crew conferences and workshops worldwide. NumPy and its API possess change into if fact be told ubiquitous.

Array proliferation and interoperability

NumPy offers in-memory, multidimensional, homogeneously typed (that is, single-pointer and strided) arrays on CPUs. It runs on machines ranging from embedded devices to the enviornment’s most fascinating supercomputers, with efficiency drawing shut that of compiled languages. For many its existence, NumPy addressed the overwhelming majority of array computation use cases.

On the other hand, scientific datasets now mechanically exceed the memory means of a single machine and can be saved on more than one machines or within the cloud. As well as, the sleek wish to flee deep-discovering out and synthetic intelligence functions has led to the emergence of specialized accelerator hardware, including graphics processing objects (GPUs), tensor processing objects (TPUs) and self-discipline-programmable gate arrays (FPGAs). Owing to its in-memory recordsdata model, NumPy is currently unable to straight yelp such storage and if fact be told expert hardware. On the other hand, both distributed recordsdata and in addition the parallel execution of GPUs, TPUs and FPGAs map well to the paradigm of array programming: attributable to this fact resulting in a gap between available contemporary hardware architectures and the tools indispensable to leverage their computational energy.

The crew’s efforts to bear this gap led to a proliferation of contemporary array implementations. As an illustration, every deep-discovering out framework created its accept as true with arrays; the PyTorch38, Tensorflow39, Apache MXNet40 and JAX arrays all possess the ability to run on CPUs and GPUs in a distributed model, the usage of indolent evaluation to allow for additonal efficiency optimizations. SciPy and PyData/Sparse both present sparse arrays, which in most cases private few non-zero values and retailer handiest these in memory for efficiency. As well as, there are initiatives that set up on NumPy arrays as recordsdata containers, and prolong its capabilities. Disbursed arrays are made imaginable that method by Dask, and labelled arrays—referring to dimensions of an array by title moderately than by index for clarity, compare x[:, 1] versus x.loc[:, ‘time’]—by xarray41.

Such libraries generally mimic the NumPy API, because this lowers the barrier to entry for inexperienced persons and offers the broader crew with a proper array programming interface. This, in flip, prevents disruptive schisms such because the divergence between Numeric and Numarray. Nevertheless exploring sleek systems of working with arrays is experimental by nature and, the truth is, diverse promising libraries (equivalent to Theano and Caffe) possess already ceased pattern. And whenever that a user decides to purchase a peep at a brand sleek technology, they have to change import statements and produce certain that the sleek library implements the entire parts of the NumPy API they currently use.

Ideally, working on if fact be told expert arrays the usage of NumPy functions or semantics would merely work, so that customers could per chance perchance perchance also write code as soon as, and would then purchase pleasure in switching between NumPy arrays, GPU arrays, distributed arrays and so forth as acceptable. To enhance array operations between external array objects, NumPy attributable to this fact added the ability to act as a central coordination mechanism with a well specified API (Fig. 2).

To facilitate this interoperability, NumPy offers ‘protocols’ (or contracts of operation), that allow for if fact be told expert arrays to be passed to NumPy functions (Fig. 3). NumPy, in flip, dispatches operations to the originating library, as required. Over four hundred of the most sleek NumPy functions are supported. The protocols are applied by broadly ancient libraries equivalent to Dask, CuPy, xarray and PyData/Sparse. Thanks to these tendencies, customers can now, to illustrate, scale their computation from a single machine to distributed systems the usage of Dask. The protocols also set up well, allowing customers to redeploy NumPy code at scale on distributed, multi-GPU systems by, to illustrate, CuPy arrays embedded in Dask arrays. The usage of NumPy’s high-stage API, customers can leverage extremely parallel code execution on more than one systems with hundreds of thousands of cores, all with minimal code modifications42.

Fig. 3: NumPy’s API and array protocols disclose sleek arrays to the ecosystem.

On this situation, NumPy’s ‘indicate’ purpose is called on a Dask array. The name succeeds by dispatching to the suitable library implementation (on this case, Dask) and ends in a brand sleek Dask array. Compare this code to the instance code in Fig. 1g.

These array protocols are now a key characteristic of NumPy, and are anticipated to handiest produce bigger in significance. The NumPy developers—different whom are authors of this Evaluation—iteratively refine and add protocol designs to toughen utility and simplify adoption.


NumPy combines the expressive energy of array programming, the efficiency of C, and the readability, usability and flexibility of Python in a veteran, well tested, well documented and crew-developed library. Libraries within the scientific Python ecosystem present swiftly implementations of most indispensable algorithms. Where coarse optimization is warranted, compiled languages could per chance perchance perchance also also be ancient, equivalent to Cython43, Numba44 and Pythran45; these languages prolong Python and transparently flee bottlenecks. Owing to NumPy’s easy memory model, it is simple to write down low-stage, hand-optimized code, in most cases in C or Fortran, to manipulate NumPy arrays and hotfoot them back to Python. Furthermore, the usage of array protocols, it is ability to yelp the elephantine spectrum of specialized hardware acceleration with minimal modifications to present code.

NumPy became within the muse developed by college students, faculty and researchers to present an developed, originate-source array programming library for Python, which became free to use and unencumbered by license servers and plot security dongles. There became a technique of building one thing consequential together for the advantage of many others. Participating in such an endeavour, within a welcoming crew of treasure-minded folks, held a extremely fine attraction for many early contributors.

These user–developers generally needed to write down code from scratch to resolve their very accept as true with or their colleagues’ concerns—generally in low-stage languages that preceded Python, equivalent to Fortran46 and C. To them, the advantages of an interactive, high-stage array library were evident. The catch of this sleek instrument became knowledgeable by diverse extremely fine interactive programming languages for scientific computing equivalent to Basis47,48,49,50, Yorick51, R52 and APL53, to boot as industrial languages and environments equivalent to IDL (Interactive Recordsdata Language) and MATLAB.

What started as an are attempting so that you can add an array object to Python turned the muse of a vivid ecosystem of tools. Now, a tall amount of scientific work depends on NumPy being intellectual, swiftly and proper. It’s miles no longer a small crew mission, but core scientific infrastructure.

The developer culture has matured: despite the incontrovertible fact that initial pattern became extremely casual, NumPy now has a roadmap and a job for proposing and discussing tall modifications. The mission has formal governance structures and is fiscally subsidized by NumFOCUS, a nonprofit that promotes originate practices in examine, recordsdata and scientific computing. All the strategy thru the previous few years, the mission attracted its first funded pattern, subsidized by the Moore and Sloan Foundations, and obtained an award as half of the Chan Zuckerberg Initiative’s Essentials of Birth Offer Instrument programme. With this funding, the mission became (and is) ready to possess sustained focal level over more than one months to enforce tall sleek parts and improvements. That mentioned, the come of NumPy easy depends heavily on contributions made by graduate college students and researchers of their free time (explore Supplementary Methods for more indispensable points).

NumPy is no longer merely the foundational array library underlying the scientific Python ecosystem, but it completely has change into the conventional API for tensor computation and a central coordinating mechanism between array forms and applied sciences in Python. Work continues to amplify on and toughen these interoperability parts.

Over the next decade, NumPy developers will face diverse challenges. Modern devices will be developed, and present if fact be told expert hardware will evolve to meet diminishing returns on Moore’s legislation. There will be more, and a wider diversity of, recordsdata science practitioners, a tall percentage of whom will use NumPy. The size of scientific recordsdata gathering will continue to produce bigger, with the adoption of devices and devices equivalent to gentle-sheet microscopes and the Natty Synoptic Scrutinize Telescope (LSST)54. Modern generation languages, interpreters and compilers, equivalent to Rust55, Julia56 and LLVM57, will catch sleek ideas and recordsdata structures, and resolve their viability.

Throughout the mechanisms described on this Evaluation, NumPy is poised to contain this kind of altering panorama, and to continue playing a number one half in interactive scientific computation, despite the incontrovertible fact that to cease so will require sustained funding from authorities, academia and enterprise. Nevertheless, importantly, for NumPy to meet the wants of the next decade of knowledge science, it could per chance also want a brand sleek generation of graduate college students and crew contributors to pressure it ahead.


  1. 1.

    Abbott, B. P. et al. Observation of gravitational waves from a binary black gap merger. Phys. Rev. Lett. 116, 061102 (2016).


    Google Pupil

  2. 2.

    Chael, A. et al. High-decision linear polarimetric imaging for the Match Horizon Telescope. Astrophys. J. 286, 11 (2016).


    Google Pupil

  3. 3.

    Dubois, P. F., Hinsen, Okay. & Hugunin, J. Numerical Python. Comput. Phys. 10, 262–267 (1996).


    Google Pupil

  4. 4.

    Ascher, D., Dubois, P. F., Hinsen, Okay., Hugunin, J. & Oliphant, T. E. An Birth Offer Mission: Numerical Python (Lawrence Livermore National Laboratory, 2001).

  5. 5.

    Yang, T.-Y., Furnish, G. & Dubois, P. F. Guidance object-oriented scientific computations. In Proc. TOOLS USA 97. Intl Conf. Skills of Object Oriented Programs and Languages (eds Ege, R., Singh, M. & Meyer, B.) 112–119 (IEEE, 1997).

  6. 6.

    Greenfield, P., Miller, J. T., Hsu, J. & White, R. L. numarray: a brand sleek scientific array kit for Python. In PyCon DC 2003 (2003).

  7. 7.

    Oliphant, T. E. Recordsdata to NumPy 1st edn (Trelgol Publishing, 2006).

  8. 8.

    Dubois, P. F. Python: batteries integrated. Comput. Sci. Eng. 9, 7–9 (2007).

    Google Pupil

  9. 9.

    Oliphant, T. E. Python for scientific computing. Comput. Sci. Eng. 9, 10–20 (2007).

    Google Pupil

  10. 10.

    Millman, Okay. J. & Aivazis, M. Python for scientists and engineers. Comput. Sci. Eng. 13, 9–12 (2011).

    Google Pupil

  11. 11.

    Pérez, F., Granger, B. E. & Hunter, J. D. Python: an ecosystem for scientific computing. Comput. Sci. Eng. 13, 13–21 (2011). Explains why the scientific Python ecosystem is a extremely productive ambiance for examine.

    Google Pupil

  12. 12.

    Virtanen, P. et al. SciPy 1.0—fundamental algorithms for scientific computing in Python. Nat. Methods 17, 261–272 (2020); correction 17, 352 (2020). Introduces the SciPy library and involves a more detailed historical past of NumPy and SciPy.

    PubMed Central 

    Google Pupil

  13. 13.

    Hunter, J. D. Matplotlib: a 2D graphics ambiance. Comput. Sci. Eng. 9, 90–95 (2007).

    Google Pupil

  14. 14.

    McKinney, W. Recordsdata structures for statistical computing in Python. In Proc. ninth Python in Science Conf. (eds van der Walt, S. & Millman, Okay. J.) 56–61 (2010).

  15. 15.

    Pedregosa, F. et al. Scikit-learn: machine discovering out in Python. J. Mach. Be taught. Res. 12, 2825–2830 (2011).


    Google Pupil

  16. 16.

    van der Walt, S. et al. scikit-image: image processing in Python. PeerJ 2, e453 (2014).

    PubMed Central 

    Google Pupil

  17. 17.

    van der Walt, S., Colbert, S. C. & Varoquaux, G. The NumPy array: a structure for ambiance generous numerical computation. Comput. Sci. Eng. 13, 22–30 (2011). Discusses the NumPy array recordsdata structure with a take care of the strategy it permits ambiance generous computation.

  18. 18.

    Wang, Q., Zhang, X., Zhang, Y. & Yi, Q. AUGEM: robotically generate high efficiency dense linear algebra kernels on x86 CPUs. In SC’13: Proc. Intl Conf. High Performance Computing, Networking, Storage and Diagnosis 25 (IEEE, 2013).

  19. 19.

    Xianyi, Z., Qian, W. & Yunquan, Z. Mannequin-driven stage 3 BLAS efficiency optimization on Loongson 3A processor. In 2012 IEEE 18th Intl Conf. Parallel and Disbursed Programs 684–691 (IEEE, 2012).

  20. 20.

    Pérez, F. & Granger, B. E. IPython: a machine for interactive scientific computing. Comput. Sci. Eng. 9, 21–29 (2007).

    Google Pupil

  21. 21.

    Kluyver, T. et al. Jupyter Notebooks—a publishing layout for reproducible computational workflows. In Positioning and Energy in Academic Publishing: Gamers, Agents and Agendas (eds Loizides, F. & Schmidt, B.) 87–90 (IOS Press, 2016).

  22. 22.

    Hagberg, A. A., Schult, D. A. & Swart, P. J. Exploring network structure, dynamics, and purpose the usage of NetworkX. In Proc. seventh Python in Science Conf. (eds Varoquaux, G., Vaught, T. & Millman, Okay. J.) 11–15 (2008).

  23. 23.

    Astropy Collaboration et al. Astropy: a crew Python kit for astronomy. Astron. Astrophys. 558, A33 (2013).

    Google Pupil

  24. 24.

    Trace-Whelan, A. M. et al. The Astropy Mission: building an originate-science mission and save of dwelling of the v2.0 core kit. Astron. J. 156, 123 (2018).


    Google Pupil

  25. 25.

    Cock, P. J. et al. Biopython: freely available Python tools for computational molecular biology and bioinformatics. Bioinformatics 25, 1422–1423 (2009).

    PubMed Central 

    Google Pupil

  26. 26.

    Millman, Okay. J. & Brett, M. Diagnosis of handy magnetic resonance imaging in Python. Comput. Sci. Eng. 9, 52–55 (2007).

    Google Pupil

  27. 27.

    The SunPy Community et al. SunPy—Python for photo voltaic physics. Comput. Sci. Discov. 8, 014009 (2015).

    Google Pupil

  28. 28.

    Hamman, J., Rocklin, M. & Abernathy, R. Pangeo: an unlimited-recordsdata ecosystem for scalable Earth machine science. In EGU Smartly-liked Assembly Conf. Abstracts 12146 (2018).

  29. 29.

    Chael, A. A. et al. ehtim: imaging, prognosis, and simulation plot for radio interferometry. Astrophysics Offer Code Library https://ascl.catch/1904.004 (2019).

  30. 30.

    Millman, Okay. J. & Pérez, F. Rising originate source scientific practice. In Implementing Reproducible Overview (eds Stodden, V., Leisch, F. & Peng, R. D.) 149–183 (CRC Press, 2014). Describes the plot engineering practices embraced by the NumPy and SciPy communities with a take care of how these practices toughen examine.

  31. 31.

    van der Walt, S. The SciPy Documentation Mission (technical overview). In Proc. seventh Python in Science Conf. (SciPy 2008) (eds Varoquaux, G., Vaught, T. & Millman, Okay. J.) 27–28 (2008).

  32. 32.

    Harrington, J. The SciPy Documentation Mission. In Proc. seventh Python in Science Conference (SciPy 2008) (eds Varoquaux, G., Vaught, T. & Millman, Okay. J.) 33–35 (2008).

  33. 33.

    Harrington, J. & Goldsmith, D. Growth picture: NumPy and SciPy documentation in 2009. In Proc. Eighth Python in Science Conf. (SciPy 2009) (eds Varoquaux, G., van der Walt, S. & Millman, Okay. J.) 84–87 (2009).

  34. 34.

    Royal Mammoth Society Command of the RAS ‘A’ Awards Committee 2020: Astropy Mission: 2020 Community Fulfillment Award (A) (2020).

  35. 35.

    Wilson, G. Instrument carpentry: getting scientists to write down better code by making them more productive. Comput. Sci. Eng. 8, 66–69 (2006).

    Google Pupil

  36. 36.

    Hannay, J. E. et al. How cease scientists set up and use scientific plot? In Proc. 2009 ICSE Workshop on Instrument Engineering for Computational Science and Engineering 1–8 (IEEE, 2009).

  37. 37.

    Millman, Okay. J., Brett, M., Barnowski, R. & Poline, J.-B. Educating computational reproducibility for neuroimaging. Entrance. Neurosci. 12, 727 (2018).

    PubMed Central 

    Google Pupil

  38. 38.

    Paszke, A. et al. Pytorch: an imperative model, high-efficiency deep discovering out library. In Advances in Neural Knowledge Processing Programs 32 (eds Wallach, H. et al.) 8024–8035 (Neural Knowledge Processing Programs, 2019).

  39. 39.

    Abadi, M. et al. TensorFlow: a machine for tall-scale machine discovering out. In OSDI’16: Proc. 12th USENIX Conf. Running Programs Plan and Implementation (chairs Keeton, Okay. & Roscoe, T.) 265–283 (USENIX Association, 2016).

  40. 40.

    Chen, T. et al. MXNet: a versatile and ambiance generous machine discovering out library for heterogeneous distributed systems. Preprint at (2015).

  41. 41.

    Hoyer, S. & Hamman, J. xarray: N–D labeled arrays and datasets in Python. J. Birth Res. Softw. 5, 10 (2017).

    Google Pupil

  42. 42.

    Entschev, P. Disbursed multi-GPU computing with Dask, CuPy and RAPIDS. In EuroPython 2019 (2019).

  43. 43.

    Behnel, S. et al. Cython: the upper of both worlds. Comput. Sci. Eng. 13, 31–39 (2011).

    Google Pupil

  44. 44.

    Lam, S. Okay., Pitrou, A. & Seibert, S. Numba: a LLVM-based entirely Python JIT compiler. In Proc. 2d Workshop on the LLVM Compiler Infrastructure in HPC, LLVM ’15 7:1–7:6 (ACM, 2015).

  45. 45.

    Guelton, S. et al. Pythran: enabling static optimization of scientific Python packages. Comput. Sci. Discov. 8, 014001 (2015).

    Google Pupil

  46. 46.

    Dongarra, J., Golub, G. H., Grosse, E., Moler, C. & Moore, Okay. Netlib and NA-Derive: building a scientific computing crew. IEEE Ann. Hist. Comput. 30, 30–41 (2008).


    Google Pupil

  47. 47.

    Barrett, Okay. A., Chiu, Y. H., Painter, J. F., Motteler, Z. C. & Dubois, P. F. Basis System, Section I: Running a Basis Program—A Tutorial for Newbies UCRL-MA-118543, Vol. 1 (Lawrence Livermore National Laboratory 1995).

  48. 48.

    Dubois, P. F. & Motteler, Z. Basis System, Section II: Basis Language Reference E-book UCRL-MA-118543, Vol. 2 (Lawrence Livermore National Laboratory, 1995).

  49. 49.

    Chiu, Y. H. & Dubois, P. F. Basis System, Section III: EZN Particular person E-book UCRL-MA-118543, Vol. 3 (Lawrence Livermore National Laboratory, 1995).

  50. 50.

    Chiu, Y. H. & Dubois, P. F. Basis System, Section IV: EZD Particular person E-book UCRL-MA-118543, Vol. 4 (Lawrence Livermore National Laboratory, 1995).

  51. 51.

    Munro, D. H. & Dubois, P. F. The usage of the Yorick interpreted language. Comput. Phys. 9, 609–615 (1995).


    Google Pupil

  52. 52.

    Ihaka, R. & Gentleman, R. R: a language for recordsdata prognosis and graphics. J. Comput. Graph. Stat. 5, 299–314 (1996).

    Google Pupil

  53. 53.

    Iverson, Okay. E. A programming language. In Proc. 1962 Spring Joint Computer Conf. 345–351 (1962).

  54. 54.

    Jenness, T. et al. LSST recordsdata management plot pattern practices and tools. In Proc. SPIE 10707, Instrument and Cyberinfrastructure for Astronomy V 1070709 (SPIE and Worldwide Society for Optics and Photonics, 2018).

  55. 55.

    Matsakis, N. D. & Klock, F. S. The Rust language. Ada Letters 34, 103–104 (2014).

    Google Pupil

  56. 56.

    Bezanson, J., Edelman, A., Karpinski, S. & Shah, V. B. Julia: a new technique to numerical computing. SIAM Rev. 59, 65–98 (2017).


    Google Pupil

  57. 57.

    Lattner, C. & Adve, V. LLVM: a compilation framework for lifelong program prognosis and transformation. In Proc. 2004 Intl Symp. Code Skills and Optimization (CGO’04) 75–88 (IEEE, 2004).

Download references


We thank R. Barnowski, P. Dubois, M. Eickenberg, and P. Greenfield, who suggested text and offered precious feedback on the manuscript. Okay.J.M. and S.J.v.d.W. were funded in half by the Gordon and Betty Moore Foundation thru grant GBMF3834 and by the Alfred P. Sloan Foundation thru grant 2013-10-27 to the College of California, Berkeley. S.J.v.d.W., S.B., M.P. and W.W. were funded in half by the Gordon and Betty Moore Foundation thru grant GBMF5447 and by the Alfred P. Sloan Foundation thru grant G-2017-9960 to the College of California, Berkeley.

Author recordsdata


  1. Self sustaining researcher, Logan, UT, USA

    Charles R. Harris

  2. Brain Imaging Center, College of California, Berkeley, Berkeley, CA, USA

    Okay. Jarrod Millman, Stéfan J. van der Walt & Matthew Brett

  3. Division of Biostatistics, College of California, Berkeley, Berkeley, CA, USA

    Okay. Jarrod Millman

  4. Berkeley Institute for Recordsdata Science, College of California, Berkeley, Berkeley, CA, USA

    Okay. Jarrod Millman, Stéfan J. van der Walt, Sebastian Berg, Matti Picus & Warren Weckesser

  5. Utilized Mathematics, Stellenbosch College, Stellenbosch, South Africa

    Stéfan J. van der Walt

  6. Quansight, Austin, TX, USA

    Ralf Gommers, Pearu Peterson, Hameer Abbasi & Travis E. Oliphant

  7. Department of Physics, College of Jyväskylä, Jyväskylä, Finland

    Pauli Virtanen

  8. Nanoscience Center, College of Jyväskylä, Jyväskylä, Finland

    Pauli Virtanen

  9. Mercari JP, Tokyo, Japan

    David Cournapeau

  10. Department of Engineering, College of Cambridge, Cambridge, UK

    Eric Wieser

  11. Self sustaining researcher, Karlsruhe, Germany

    Julian Taylor

  12. Self sustaining researcher, Berkeley, CA, USA

    Nathaniel J. Smith

  13. Enthought, Austin, TX, USA

    Robert Kern

  14. Google Overview, Mountain Explore, CA, USA

    Stephan Hoyer

  15. Department of Astronomy and Astrophysics, College of Toronto, Toronto, Ontario, Canada

    Marten H. van Kerkwijk

  16. School of Psychology, College of Birmingham, Edgbaston, Birmingham, UK

    Matthew Brett

  17. Department of Physics, Temple College, Philadelphia, PA, USA

    Allan Haldane

  18. Google, Zurich, Switzerland

    Jaime Fernández del Río

  19. Department of Physics and Astronomy, The College of British Columbia, Vancouver, British Columbia, Canada

    Designate Wiebe

  20. Amazon, Seattle, WA, USA

    Designate Wiebe

  21. Self sustaining researcher, Saue, Estonia

    Pearu Peterson

  22. Department of Mechanics and Utilized Mathematics, Institute of Cybernetics at Tallinn Technical College, Tallinn, Estonia

    Pearu Peterson

  23. Department of Natural and Agricultural Engineering, College of Georgia, Athens, GA, USA

    Pierre Gérard-Marchant

  24. France-IX Companies, Paris, France

    Pierre Gérard-Marchant

  25. Department of Economics, College of Oxford, Oxford, UK

    Kevin Sheppard

  26. CCS-7, Los Alamos National Laboratory, Los Alamos, NM, USA

    Tyler Reddy

  27. Laboratory for Fluorescence Dynamics, Biomedical Engineering Department, College of California, Irvine, Irvine, CA, USA

    Christoph Gohlke


Okay.J.M. and S.J.v.d.W. quiet the manuscript with enter from others. S.B., R.G., Okay.S., W.W., M.B. and T.R. contributed text. All authors contributed tall code, documentation and/or journey to the NumPy mission. All authors reviewed the manuscript.

Corresponding authors

Correspondence to
Okay. Jarrod Millman or Stéfan J. van der Walt or Ralf Gommers.

Ethics declarations

Competing interests

The authors disclose no competing interests.

Extra recordsdata

Leer evaluation recordsdata Nature thanks Edouard Duchesnay, Alan Edelman and the diverse, nameless, reviewer(s) for their contribution to the behold evaluation of this work.

Publisher’s disclose Springer Nature stays unbiased with regard to jurisdictional claims in published maps and institutional affiliations.

Supplementary recordsdata

Supplementary Knowledge

This file comprises Supplementary Methods, including Supplementary Figure 1 and further references.

About this text

Verify currency and authenticity via CrossMark

Cite this text

Harris, C.R., Millman, Okay.J., van der Walt, S.J. et al. Array programming with NumPy.
Nature 585, 357–362 (2020).

Download citation


By submitting a comment you agree to abide by our Phrases and Community Pointers. Whenever you occur to search out one thing abusive or that doesn’t agree to our terms or guidelines please flag it as wicked.

Read More

Leave A Reply

Your email address will not be published.