How to fix NumPy timedelta64 TypeError: Invalid datetime unit "min" in metadata

Problem:

You want to construct a NumPy timedelta64 from a value in minutes using

np.timedelta64(1, 'min')

but you see an error message like

Traceback (most recent call last):
  File "test.py", line 3, in <module>
    delta = np.timedelta64(1, 'min')
TypeError: Invalid datetime unit "min" in metadata

Solution

numpy uses m as specifier for minutes, not min! Change your code to

np.timedelta64(1, 'm')