Pandas條形圖與散點圖
(1)柱狀圖的繪畫
import matplotlib.pyplot as plt
import pandas as pd
from numpy import arange
review = pd.read_csv(r"...檔案地址..")
cols = ["FILM", "RT_user_norm", "Metacritic_user_nom", "IMDB_norm", "Fandango_Ratingvalue", "Fandango_Stars"]
num_cols = ["RT_user_norm", "Metacritic_user_nom", "IMDB_norm", "Fandango_Ratingvalue", "Fandango_Stars"]
norm_reviews = reviews[cols]
bar_height = norm_review.ix[0, num_cols].values #[4.3 3.55 3.9 4.5 5. ],為x軸柱狀圖數值的大小
bar_position = arange(5) + 0.75 #[0.75 1.75 2.75 3.75 4.75], 為x軸柱狀圖,距離原點的距離
fig, ax = plt.subplots() #畫出方框
ax.bar(bar_height, bar_position, 0.3) #在方框內畫圖,0.3為柱子的寬度
plt.show()
結果為: