31ac13263bbc1efc71b2e76893c82e2b8ca6c29e,lore/transformers.py,Age,transform,#Age#Any#,71

Before Change


        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()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: instacart/lore
Commit Name: 31ac13263bbc1efc71b2e76893c82e2b8ca6c29e
Time: 2018-04-02
Author: montanalow@users.noreply.github.com
File Name: lore/transformers.py
Class Name: Age
Method Name: transform


Project Name: Kamnitsask/deepmedic
Commit Name: 04b6bdf201c45d5759d0daed1bd898bad0643ff4
Time: 2019-02-11
Author: konstantinos.kamnitsas12@imperial.ac.uk
File Name: deepmedic/logging/loggers.py
Class Name: Logger
Method Name: print3


Project Name: home-assistant/home-assistant
Commit Name: 9f042db0f5344b4e6af6b1dd2f888ce8909cbfe3
Time: 2015-05-08
Author: fabian@affolter-engineering.ch
File Name: homeassistant/components/sensor/time_date.py
Class Name: TimeDateSensor
Method Name: update