Pandas Secondary Axis

前端 未结 1 894
面向向阳花
面向向阳花 2020-12-30 13:00

I have the following data frame

    Date        A           B
0   2017-05-31  17453139    5.865738
1   2017-06-30  17425164    5.272728
2   2017-07-31  17480         


        
相关标签:
1条回答
  • 2020-12-30 13:34

    IIUC:

    ax = df.plot('Date','A')
    ax1 = ax.twinx()
    df.plot('Date','B',ax=ax1, color='r')
    

    Output:

    Or you can use secondary_y in Pandas plot:

    ax = df.plot('Date','A')
    df.plot('Date','B',secondary_y=True, ax=ax)
    

    Output:

    0 讨论(0)
提交回复
热议问题