O'Reilly logo

NumPy Cookbook - Second Edition by Ivan Idris

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Special Arrays and Universal Functions

In this chapter, we will cover the following recipes:

  • Creating a universal function
  • Finding Pythagorean triples
  • Performing string operations with chararray
  • Creating a masked array
  • Ignoring negative and extreme values
  • Creating a scores table with a recarray function

Introduction

This chapter is about special arrays and universal functions. These are topics that you may not encounter every day, but they are still important enough to mention here. Universal functions (Ufuncs) work on arrays element by element, or on scalars. Ufuncs accept a set of scalars as the input and produce a set of scalars as the output. Universal functions can typically be mapped onto their mathematical counterparts such as addition, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required