0

Considering the below example in df I have ts as datetime.

df.dtypes

parts_produced             int64
event                     object
c                         object
ts                datetime64[ns]
dtype: object

Now, I am trying to check if ts is empty because it is when I do a shift(-1) on a column ts for the last record.

If I check np.isnat(ts), I get :

TypeError: ufunc 'isnat' is only defined for datetime and timedelta.

Debugging step:

p ts
Timestamp('2020-09-10 00:10:00')

np.isnat(ts)
*** TypeError: ufunc 'isnat' is only defined for datetime and timedelta.
s_mj
  • 530
  • 11
  • 28
  • 1
    Please post sample input and expected output for better understanding. – Mayank Porwal Dec 18 '20 at 14:33
  • 2
    Does this answer your question? [Numpy isnat() returns value error on datetime objects](https://stackoverflow.com/questions/48194470/numpy-isnat-returns-value-error-on-datetime-objects) – Daniel Habenicht Nov 11 '22 at 15:23

0 Answers0