Home > OS >  Pandas/Altair - plot multiple series
Pandas/Altair - plot multiple series

Time:08-20

I have the following Pandas DataFrame (from read_csv):

In [6]: rev_df.head()
Out[6]:
          Entity Code  Year  National Gov Revenues (Wallis (2000))  Local Gov Revenues (Wallis (2000))  State Gov Revenues (Wallis (2000))
0  United States  USA  1902                                    3.0                                 4.0                                 0.8
1  United States  USA  1913                                    2.4                                 4.2                                 0.9
2  United States  USA  1922                                    5.8                                 5.2                                 1.7
3  United States  USA  1927                                    4.7                                 6.0                                 2.1
4  United States  USA  1934                                    6.0                                 7.6                                 3.8

Year is a column, and there are 3 additional columns, 1 each for Local/State/National revenues. I'd like to create a stacked area chart, like this: enter image description here

Your date approach is fine but you can also use parse_dates as in my example above.

  • Related