import matplotlib.pyplot as plt
import numpy as np
import matplotlib as mpl
import pandas as pd
filepath='E:/PROJECT ON DATA SCIENCE/boxplot/fee.csv';
X=pd.read_csv(filepath_or_buffer=filepath,index_col=0)
X.boxplot(by='stype', column='fee')
X.boxplot(by='pincode', column='fee')
答案 0 :(得分:1)
如果您想通过stype
和pincode
对X分组进行箱线图绘制,则可以使用
X.boxplot(column='fee', by=['stype', 'pincode'])
完整的代码应该是
import matplotlib.pyplot as plt
import numpy as np
import matplotlib as mpl
import pandas as pd
filepath='E:/PROJECT ON DATA SCIENCE/boxplot/fee.csv';
X=pd.read_csv(filepath_or_buffer=filepath,index_col=0)
X.boxplot(column='fee', by=['stype', 'pincode'])