Skip to content

Instantly share code, notes, and snippets.

@erichooi
Last active June 23, 2019 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erichooi/412747f78697b18af4e25677cef90d19 to your computer and use it in GitHub Desktop.
Save erichooi/412747f78697b18af4e25677cef90d19 to your computer and use it in GitHub Desktop.
data = pd.DataFrame()
for col in _data.columns:
if col != "bookingID" and col != "label":
temp = _data.groupby("bookingID")[col].agg(["mean", "sum", "max", "min"])
data[col + "_mean"] = temp["mean"]
data[col + "_sum"] = temp["sum"]
data[col + "_max"] = temp["max"]
data[col + "_min"] = temp["min"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment