As show in figure I have two dataframe columns of type datetime64[ns]. I need to find difference between them. When I try to do so, I am getting error. If I try to find difference between one element of each column in same data frame, it is giving me time delta.Is there something that I may be missing?
- I have included date time
- These columns are converted from int64 type column using pd.to_datetime()
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () ----> 1 c = data['created_at'] - data['launched_at']
/home/adi/.virtualenvs/datascience/local/lib/python2.7/site-packages/pandas/core/ops.pyc in wrapper(left, right, name, na_op) 694 left, right = _align_method_SERIES(left, right) 695 --> 696 converted = _Op.get_op(left, right, name, na_op) 697 698 left, right = converted.left, converted.right
/home/adi/.virtualenvs/datascience/local/lib/python2.7/site-packages/pandas/core/ops.pyc in get_op(cls, left, right, name, na_op) 328 return _Op(left, right, name, na_op) 329 else: --> 330 return _TimeOp(left, right, name, na_op) 331 332
/home/adi/.virtualenvs/datascience/local/lib/python2.7/site-packages/pandas/core/ops.pyc in init(self, left, right, name, na_op) 341 super(_TimeOp, self).init(left, right, name, na_op) 342 --> 343 lvalues = self._convert_to_array(left, name=name) 344 rvalues = self._convert_to_array(right, name=name, other=lvalues) 345
/home/adi/.virtualenvs/datascience/local/lib/python2.7/site-packages/pandas/core/ops.pyc in _convert_to_array(self, values, name, other) 452 supplied_dtype = values.dtype 453 inferred_type = supplied_dtype or lib.infer_dtype(values) --> 454 if (inferred_type in ('datetime64', 'datetime', 'date', 'time') or 455 is_datetimetz(inferred_type)): 456 # if we have a other of timedelta, but use pd.NaT here we
TypeError: data type "datetime" not understood
As int64 datatype:
After conversion to datetime format