self.unit = unit
def transform(self, data):
age = (datetime.datetime.now() - self.series(data))
if self.unit in ["nanosecond", "nanoseconds"]:
return age
seconds = age.dt.total_seconds()
After Change
series = self.series(data)
other = self.other_series(data)
if other is None:
other = datetime.datetime.now()
elif other.dtype != "datetime64[ns]":
logger.warning("%s is not a datetime. Converting to datetime64[ns]" % self.column)
other = pandas.to_datetime(other).astype("datetime64[ns]")
if series.dtype != "datetime64[ns]":
logger.warning("%s is not a datetime. Converting to datetime64[ns]" % self.column)
other = pandas.to_datetime(other).astype("datetime64[ns]")age = (other - self.series(data))
if self.unit in ["nanosecond", "nanoseconds"]:
return age
seconds = age.dt.total_seconds()