Q:

Timeseries with multiple columns, each with duplicate entries. How to handle in pandas

Have the following dataframe with duplicate values in the Date and UID columns:
Date           UID       Score
2018-08-31       A          5
2018-08-31       B          3
2018-08-31       C          4
2018-05-31       A          4
2018-05-31       C          2
2018-05-31       A          4
2018-05-31       B          1
2018-05-31       A          3
2018-01-31       C          5
2018-01-31       A          3
2018-01-31       A          4
2018-01-31       C          2
2018-01-31       B          5

If duplicate UID occurs on the same Date, want to create something like the following:
2018-08-31       A          5
2018-05-31       A          3.67
2018-01-31       A          3.5

2018-08-31       B          3
2018-05-31       B          1
2018-01-31       B          5

2018-08-31       C          4
2018-05-31       C          2
2018-01-31       C          3.5

What I would like to accomplish is split the original dataframe into multiple timeseries that I can plot together and play around with. In this case, how can I reshape this dataframe so that I can play with 3 distinct timeseries based on UID scores?
I seem to be stuck at the following point...
df.groupby(['Date', 'UID'], as_index=False)['Score'].mean()

...and I can't get my head around how to reshape this properly.
Appreciate any feedback.

A:

I think your only problem is the order in your group by.  Try:
#Recreating your frame
df = pd.DataFrame( [['2018-08-31',     'A',         '5'],['2018-08-31','B',3],
['2018-08-31','C',4],
['2018-05-31','A',4],
['2018-05-31','C',2],
['2018-05-31','A',4],
['2018-05-31','B',1],
['2018-05-31','A',3],
['2018-01-31','C',5],
['2018-01-31','A',3],
['2018-01-31','A',4],
['2018-01-31','C',2],
['2018-01-31','B',5]] , columns =  ['Date','UID','Score'])
df['Score'] = pd.to_numeric(df['Score'])

#The solution
df.groupby(['UID', 'Date']).mean()

This yields:
                Score
UID Date    
A   2018-01-31  3.500000
    2018-05-31  3.666667
    2018-08-31  5.000000
B   2018-01-31  5.000000
    2018-05-31  1.000000
    2018-08-31  3.000000
C   2018-01-31  3.500000
    2018-05-31  2.000000
    2018-08-31  4.000000

Plotting can be done like this:
df.groupby(['UID','Date']).mean().loc["A"].plot()
df.groupby(['UID','Date']).mean().loc["B"].plot()
df.groupby(['UID','Date']).mean().loc["C"].plot()

