For background: I am using the Consumer Financial Protection Bureau dataset on consumer complaints. I want to make a complaint-wise time-series plot by plotting complaint-wise counts on y and time on x getting a line for each type of complaint. I want to see how the values have changed over time. I've experimented with Seaborn and Plotly so far. Below is in Plotly.
trace1 = go.Scatter(x=df.DateReceived,
y=df.Sum,
name = "Time Series of Types of Complaints",
line = dict(color = 'blue'),
opacity = 0.4)
layout = dict(title='Time Series of Types of Complaints',)
fig = dict(data=[trace1], layout=layout)
iplot(fig)

The dataframe looks like this:
data = {'Date': ['2011-12-01', '2011-12-06', '2011-12-06', '2011-12-07', '2011-12-07'], 'Issue': ['Loan Modification', 'Loan Servicing', 'Loan Servicing', 'Loan Modification', 'Loan Servicing'], 'Sum': [1, 1, 2, 2, 3]}
df = pd.DataFrame(data)
I know the issue in my plot is that it's connecting all of the different sums together and not separating them.
I know I could separate each sum into different columns for each of the different types of complaints. And then adding each trace on manually, doing something like this (taken from Plotly website):
fig.add_trace(go.Scatter(
x=df.Date,
y=df['AAPL.Low'],
name="AAPL Low",
line_color='dimgray',
opacity=0.8))
But there must be an easier / less bruteforce way, where I can keep all of the sums in one column, and delineate by type of issue.


