516b77610d058cfe3a6f379e8ff9753065d48707,janitor/functions.py,,groupby_agg,#,3208
Before Change
:returns: A pandas DataFrame.
new_col = df.groupby(by)[agg_column_name].transform(agg)
df_new = df.assign(**{new_column_name: new_col})
return df_new
@pf.register_dataframe_accessor("data_description")
After Change
// .isnull().any()
if any(df[col].hasnans for col in by):
mapping = {
column: ".*^%s1ho1go1logoban?*&-|/\\gos1he()//_" for column in by
}
df[new_column_name] = (
df.fillna(mapping).groupby(by)[agg_column_name].transform(agg)
)
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 6
Instances
Project Name: ericmjl/pyjanitor
Commit Name: 516b77610d058cfe3a6f379e8ff9753065d48707
Time: 2020-08-09
Author: samueloranyeli@gmail.com
File Name: janitor/functions.py
Class Name:
Method Name: groupby_agg
Project Name: tyarkoni/pliers
Commit Name: af8f451f0df8f93092d50f28c6200a1ba8f99d81
Time: 2017-12-01
Author: delavega@utexas.edu
File Name: pliers/utils/updater.py
Class Name:
Method Name: check_updates
Project Name: openai/pixel-cnn
Commit Name: 420747a2f5f6f23b84f62f9a00481ef53a4a4623
Time: 2016-11-11
Author: tim@Tims-MacBook-Pro.local
File Name: train.py
Class Name:
Method Name: sample_from_model
Project Name: nilmtk/nilmtk
Commit Name: 7d5c595768fb372606290277996ec63c5489aa11
Time: 2014-12-19
Author: jack-list@xlk.org.uk
File Name: nilmtk/metergroup.py
Class Name: MeterGroup
Method Name: draw_wiring_graph