Use index in pandas to plot data

前端 未结 4 911
春和景丽
春和景丽 2020-12-05 06:51

I have a pandas-Dataframe and use resample() to calculate means (e.g. daily or monthly means). Here is a small example.

import pandas as pd  
i         


        
相关标签:
4条回答
  • 2020-12-05 06:55

    Also,

    monthly_mean.plot(x=df.index, y='A')

    0 讨论(0)
  • 2020-12-05 06:57

    Try this,

    monthly_mean.plot(y='A', use_index=True)
    
    0 讨论(0)
  • 2020-12-05 07:00

    You can use reset_index to turn the index back into a column:

    monthly_mean.reset_index().plot(x='index', y='A')
    
    0 讨论(0)
  • 2020-12-05 07:17
    monthly_mean.plot(y='A')
    

    Uses index as x-axis by default.

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