e5c62b49200a6adef9f9c92469b866161f999046,lambdas/pkgselect/index.py,,file_list_to_folder,#Any#,52

Before Change


    lambda).
    
    try:
        folder = pd.Series(df.logical_key.dropna().str.extract("([^/]+/?).*")[0].unique())
        prefixes = folder[folder.str.endswith("/")].sort_values().tolist()
        objects = folder[~folder.str.endswith("/")].sort_values().tolist()
    except AttributeError:
        // Pandas will raise an attribute error if the DataFrame has
        // no rows with a non-null logical_key. We expect that case if

After Change


        groups = df.groupby(df.logical_key.str.extract("([^/]+/?).*")[0], dropna=True)
        folder = groups.agg(
            size=("size", "sum"),
            physical_key=("physical_key", "first")
        )
        folder.reset_index(inplace=True)  // move the logical_key from the index to column[0]
        folder.rename(columns={0: "logical_key"}, inplace=True)  // name the new column
        // Do not return physical_key for prefixes
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: quiltdata/quilt
Commit Name: e5c62b49200a6adef9f9c92469b866161f999046
Time: 2020-09-23
Author: kevinemoore@gmail.com
File Name: lambdas/pkgselect/index.py
Class Name:
Method Name: file_list_to_folder


Project Name: catalyst-cooperative/pudl
Commit Name: f3ed367fe1e586c73ac5fe39fef7b916d5987f2b
Time: 2020-02-12
Author: zane.selvans@catalyst.coop
File Name: src/pudl/output/eia860.py
Class Name:
Method Name: plants_utils_eia860


Project Name: catalyst-cooperative/pudl
Commit Name: 5aaa63d7ecf85d341fec9b758d17f2bf4cde6042
Time: 2020-03-11
Author: zane.selvans@catalyst.coop
File Name: src/pudl/transform/ferc1.py
Class Name: FERCPlantClassifier
Method Name: predict