Home > Blockchain >  Rename Pandas .agg() columns inside function call
Rename Pandas .agg() columns inside function call

Time:02-05

Is there a way to do the following inside the .agg() function?

hl = df[["sym", "bid", "ask"]].groupby("sym").agg(["min", "max"])
hl = hl.rename(columns={"min": "low", "max": "high"})

I see from the pandas input dataframe output dataframe

  •  Tags:  
  • Related