12b309342f718da259eabd189b74269932f485fa,nilmtk/stats/goodsectionsresults.py,GoodSectionsResults,import_from_cache,#GoodSectionsResults#,109

Before Change


    def import_from_cache(self, cached_stat, sections):
        usable_sections_from_cache = pd.DataFrame()
        for section in sections:
            try:
                row = cached_stat.loc[section.start]
            except KeyError:
                pass
            else:
                end_time = row["end"]
                if end_time == section.end:
                    usable_sections_from_cache = (
                        usable_sections_from_cache.append(row))

        grouped_by_index = usable_sections_from_cache.groupby(level=0)
        for name, group in grouped_by_index:
            assert group["end"].unique().size == 1
            timeframes = [TimeFrame(row["section_start"], row["section_end"])

After Change


        for name, group in grouped_by_index:
            assert group["end"].unique().size == 1
            timeframe = TimeFrame(name, group["end"].iloc[0])
            if timeframe in sections:
                timeframes = [TimeFrame(row["section_start"], row["section_end"])
                              for _, row in group.iterrows()]
                self.append(timeframe, {"sections": [timeframes]})
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: nilmtk/nilmtk
Commit Name: 12b309342f718da259eabd189b74269932f485fa
Time: 2014-11-26
Author: jack-list@xlk.org.uk
File Name: nilmtk/stats/goodsectionsresults.py
Class Name: GoodSectionsResults
Method Name: import_from_cache


Project Name: brian-team/brian2
Commit Name: 6c67a2e0031876c73f3251f3e4a4cfea67313085
Time: 2017-07-18
Author: charleetje@gmail.com
File Name: brian2/codegen/generators/GSL_generator.py
Class Name: GSLCodeGenerator
Method Name: find_used_variables


Project Name: daavoo/pyntcloud
Commit Name: e513867ab755ede81a4a33b125d902bc49b51d13
Time: 2017-02-17
Author: daviddelaiglesiacastro@gmail.com
File Name: pyntcloud/io/npz.py
Class Name:
Method Name: read_npz