I'm aware that this similar question has been asked; however, I'm looking for further clarification to have better understanding of .groupby if it's possible. Data used
I want the exact same result like this but with .groupby():
df.pivot(columns='survived').age.plot.hist() So I try:
df.groupby('age')['survived'].count().plot.hist() The x-axis doesn't look right. Is there any way I can get the same result as .pivot() does using the pure .groupby() method? Thank you.
https://stackoverflow.com/questions/66701446/pandas-plot-hist-with-groupby March 19, 2021 at 09:38AM

没有评论:
发表评论