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

5 Most Useful Datetime Support Functions of NumPy

NumPy is a python library that is mainly used for working with arrays.

NumPy provides routines for performing mathematical, logical, statistical operations on multi dimensional arrays. It also has functions for performing shape manipulation, discrete Fourier transforms, linear algebra, random simulation and much more.

Majority of the datasets have date column and so its worth spending some time on the datetime support functions on Numpy. Let's take a look at the date time support functions in numpy.

  • datetime_as_string(arr[, unit, timezone, …]) --- Convert an array of datetimes into an array of strings.

  • busdaycalendar([weekmask, holidays]) --- A business day calendar object that efficiently stores information defining valid -days for the busday family of functions.

  • is_busday(dates[, weekmask, holidays, …]) --- Calculates which of the given dates are valid days, and which are not.

  • busday_offset(dates, offsets[, roll, …]) --- First adjusts the date to fall on a valid day according to the roll rule, then applies offsets to the given dates counted in valid days.

  • busday_count(begindates, enddates[, …]) --- Counts the number of valid days between begindates and enddates, not including the day of enddates.

!pip install jovian --upgrade -q
import jovian
jovian.commit(project='numpy-assignment2-Rajalakshmi')
[jovian] Updating notebook "raji/numpy-assignment2-rajalakshmi" on https://jovian.ai [jovian] Committed successfully! https://jovian.ai/raji/numpy-assignment2-rajalakshmi

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