Advertisement
elena1234

lineplot with groupby in Python

May 29th, 2022 (edited)
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. sns.lineplot(x = df.groupby(df.index).mean().index,
  2. y = df.groupby(df.index).mean()['gross income'])
  3.  
  4.  
  5.  
  6. sns.relplot(data = df, x = "Item_No", y = "Width", kind = "line", aspect = 3)
  7. mean = np.mean(df["Width"])
  8. std = np.std(df["Width"])
  9. plt.axhline(y = mean, color = "red", linestyle = "-")
  10. plt.axhline(y = (mean + 3 * std), color = "red", linestyle = "-")
  11. plt.axhline(y = (mean - 3 * std), color = "red", linestyle = "-")
  12. plt.xticks(rotation = 45)
  13. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement