設定 legend=False 時出現 TypeError,但根據檔案,這應該不是問題。我究竟做錯了什么?
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.plot.html
import pandas as pd
pd.options.plotting.backend = "plotly"
row = df.iloc[0]
row.plot(kind='bar', legend=False)
TypeError: bar() got an unexpected keyword argument 'legend'
df.iloc[0] 中的資料如下所示
RevolvingUtilizationOfUnsecuredLines 0.223647
age 0.071428
NumberOfTime30-59DaysPastDueNotWorse 1.130581
DebtRatio 0.361630
MonthlyIncome -0.277019
NumberOfOpenCreditLinesAndLoans 0.025073
NumberOfTimes90DaysLate -0.342467
NumberRealEstateLoansOrLines 0.728451
NumberOfTime60-89DaysPastDueNotWorse -0.196677
NumberOfDependents -0.061967
MonthlyIncomePerPerson -0.029531
isRetired 0.016656
Q1_Monthly_Income_True 0.032911
Q3_Monthly_Income_True -0.000393
Q1_Revolving_True 0.023684
Q3_Revolving_True 0.273972
uj5u.com熱心網友回復:
您正在生成一個情節圖。因此更改回傳的布局
pd.options.plotting.backend = "plotly"
df.iloc[1].plot(kind="bar").update_layout(showlegend=False)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/456073.html
下一篇:Pandas解壓json列
