Python Forum
How to group by name and column in box plot
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to group by name and column in box plot
#1
Hi,
I have below DataFrame, and I want to visualize the data using box plot and group by Name & column
Category   Var1     Var2      Var3

JAY       1.0        2.4       90
JAY       1.4        3.1       67
JAY       1.0        2.4       90
HKL       0.8        9.1       0.7
HKL       1.5        4.2       2.6
HKL       2.4        8.2       0.7
HKL       1.1        7.2       9.5
HKL       2.8        6.4       0.56
GHT       1.6        5.4       20
GHT       1.8        4.3       6.7
GHT       3.0        5.4       5.7
GHT       0.38       2.5       0.7
GHT       2.8        6.1       4.8
GHT       1.5        0.2       9.2

I want to draw box plot group by Category for each "Var" 
One section of box plot of different Category for Var1, 2nd section is for Different tools of Var2 etc..

I tried as below, but it did not work

import pandas as pd
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(10,8))
plt.suptitle('')
df.boxplot(column=['Category'], by=['Var1','Var2','Var3'] ax=ax)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Get an average of the unique values of a column with group by condition and assign it klllmmm 0 268 Feb-17-2024, 05:53 PM
Last Post: klllmmm
  df column aggregate and group by multiple columns SriRajesh 0 1,038 May-06-2022, 02:26 PM
Last Post: SriRajesh
  pandas pivot table: How to find count for each group in Index and Column JaneTan 0 3,300 Oct-23-2021, 04:35 AM
Last Post: JaneTan
  Annotating plot bar from values of other a specific column celinafregoso99 0 1,953 Mar-10-2021, 03:19 PM
Last Post: celinafregoso99
  How to plot intraday data of several days in one plot mistermister 3 2,903 Dec-15-2020, 07:43 PM
Last Post: deanhystad
  How to plot vertically stacked plot with same x-axis and SriMekala 0 1,918 Jun-12-2019, 03:31 PM
Last Post: SriMekala

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020