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 11. Latest and Greatest NumPy

In this chapter, we cover the following recipes:

  • Fancy indexing in place of ufuncs with the at() method
  • Partial sorting via selection of the fast median with the partition() function
  • Skipping NaNs with the nanmean(), nanvar(), and nanstd() functions
  • Creating value-initialized arrays with the full() and full_like() functions
  • Random sampling with numpy.random.choice()
  • Using the datetime64 type and the related API

Introduction

Since the first edition of NumPy Cookbook, the NumPy team has introduced new features; I will describe them in this chapter. It's probably unlikely that you read the first edition of this book and are now reading the second edition. I wrote the first edition in 2012 and used the then available ...

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