Learn practical skills, build real-world projects, and advance your career

5 Interesting NumPy array functions I just discovered

As a beginner just dipping my toes into Python (and NumPy), I've found so many useful and interesting functions at my disposal. Here are just five of the ones I liked and wanted to share.

NumPy is a Python library that provides a multidimensional array object, and all kinds of routines to operate on your arrays. Everything about NumPy revolves around a new object it introduces to your toolkit called an ndarray. NumPy changes the way you can interact with your data by allowing you to more easily and intuitively perform simple math functions, basic Boolean/comparative functions, basic linear algebra, basic statistical operations, etc.

There is a lot of great documentation for this distributed, volunteer, open-source project. The two main sources I looked at were this NumPy Reference manual, for Release 1.19.0 and the NumPy v1.20.dev0 Manual.

Coming from an business background, with very little exposure to math after first-year calculus and linear algebra (from well over a decade ago now), I'm sure I won't be using NumPy to its full potential just yet. However, I'm still intrigued by the pieces that I can use now... and I'm excited to dive into areas of NumPy like linear algebra functions and Fourier transformations in the future!

The five functions I want to explore here are:

  • Creating a business day calendar object (busdaycalendar)
  • Counting the number of business days between two dates, exclusive (busday_count)
  • Offsetting any date by any number of business dates (busday_offset)
  • Join a sequence of arrays along an existing axis (concatenate)
  • Flip an array's axes (transpose)

The recommended way to run this notebook is to click the "Run" button at the top of this page, and select "Run on Binder". This will run the notebook on mybinder.org, a free online service for running Jupyter notebooks.

!pip install jovian --upgrade -q
import jovian
jovian.commit(project='numpy-array-operations')
[jovian] Attempting to save notebook.. [jovian] Updating notebook "inunoriginal1/numpy-array-operations" on https://jovian.ml/ [jovian] Uploading notebook.. [jovian] Capturing environment.. [jovian] Committed successfully! https://jovian.ml/inunoriginal1/numpy-array-operations

Let's begin by importing Numpy and listing out the functions covered in this notebook.