Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

สร้าง Bar Plot ด้วย Seaborn - Python Pandas

บทนำ

Bar Plot แสดงประมาณค่าและช่วงเชื่อมั่นเป็นแท่งสี่เหลี่ยม ใช้ seaborn.barplot() กับข้อมูล Cricketers.csv

โค้ดตัวอย่าง

import seaborn as sb
import pandas as pd
import matplotlib.pyplot as plt

dataFrame = pd.read_csv("C:\\Users\\amit_\\Desktop\\Cricketers.csv")
sb.barplot(x=dataFrame["Height"])
plt.xlabel("Height (inches)")
plt.show()

ผลลัพธ์

ได้ Bar Plot แสดงความสูงเฉลี่ยของนักคริกเก็ต พร้อม Error Bars