Last active
February 2, 2021 16:16
-
-
Save dhananjaychaudhari26/500411013edca0dead8cf32b7c5eb8bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mode = lambda x: Counter(x).most_common(1)[0][0] | |
agg_merchants=merchants.groupby('merchant_id',as_index=False).agg({ | |
"merchant_group_id": mode, | |
"merchant_category_id": mode, | |
"subsector_id": mode, | |
"numerical_1": "mean", | |
"numerical_2": "mean", | |
"category_1": mode, | |
"most_recent_sales_range": mode, | |
"most_recent_purchases_range": mode, | |
"avg_sales_lag3": "mean", | |
"avg_purchases_lag3": "mean", | |
"active_months_lag3": mode, | |
"avg_sales_lag6": "mean", | |
"avg_purchases_lag6": "mean", | |
"active_months_lag6": mode, | |
"avg_sales_lag12": "mean", | |
"avg_purchases_lag12": "mean", | |
"active_months_lag12": mode, | |
"category_4": mode, | |
"city_id": mode, | |
"state_id": mode, | |
"category_2": mode | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment