简体   繁体   中英

How to display pandas pivot table as seaborn barplot?

I've imported a CSV file in to a data frame and created a pivot table:

            Amount
Date              
2018-09-30     222
2018-10-01     105
2018-10-02      32
2018-10-03     155
2018-10-04     156

How do I plot this as a bar graph? trying to use this but it gives me errors:

sns.barplot(x="Date", y="Amount", Data=Tx_Data)

Could not interpret input 'Date'

Your Date is not a column but an index. Try

sns.barplot(x=df.index, y="Amount", data=df)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM