从matplotlib中的选定列绘制条形图

时间:2017-05-14 14:03:26

标签: python matplotlib dataframe histogram bar-chart

如果我的hotel_type中有变量DataFrame,我会计算每个hotel_type的数量

以下命令:

`df.hotel_type.value_counts()`

给出了结果:

Apartment            3157
Hotel                 115
Villa                  54
Bed and Breakfast      48
Holiday home           21

问题:如何使用x轴绘制条形图和直方图:酒店类型和y轴:使用matplotlib每种酒店类型的数量?

1 个答案:

答案 0 :(得分:2)

尝试Series.plot.barh

static Book searchTitle(){
    Scanner input = new Scanner(System.in))
        String booktitle;
        System.out.println("Please enter title:");
        booktitle = input.nextLine();

        for(Book b : BookList){
            if(b.getTitle() != null && b.getTitle().equals(booktitle)){
                System.out.println(b.toString());
                return (Book) b;
        }

    System.out.println("not found");
    return null;
}

更新

ffmpeg -i input -filter_complex \
"[0:v]crop=iw/2:ih/2:0:0[lt]; \
 [0:v]crop=iw/2:ih/2:ow:0[rt]; \
 [0:v]crop=iw/2:ih/2:0:oh[lb]; \
 [0:v]crop=iw/2:ih/2:ow:oh[rb]; \
 [lb][lt]hstack[top]; \
 [rt][rb]hstack[bottom]; \
 [top][bottom]vstack" \
-c:a copy output