pandas plot time series with categories code example

pandas plot time series with categories

1

1 Example

0
import pandas as pd
categorical = ["cat1","cat1","cat2","cat3","cat2","cat1","cat3","cat2",
               "cat1","cat3","cat3","cat3","cat2","cat1","cat2","cat3",
               "cat2","cat2","cat3","cat1","cat1","cat1","cat3"]
year = [2013,2014,2013,2015,2014,2014,2013,2014,2014,2015,2015,2013,
        2014,2014,2013,2014,2015,2015,2015,2013,2014,2015,2013]
df = pd.DataFrame({'categorical':categorical,
                   'year':year})

   categorical  year
 0        cat1  2013
 1        cat1  2014
                 ...
21        cat1  2015
22        cat3  2013
by on

Other Code Examples