Black Lives Matter. Please consider donating to Black Girls Code today.

Struggling with plotting weekly time series data

Hi

I am trying to plot weekly totals in Dash and I have my data summarised in a df by “Week Commencing” dates.

The figure I am generating is this:

{'data': [Scatter({
    'mode': 'lines',
    'name': 'Trace1',
    'x': array([datetime.date(2019, 12, 30), datetime.date(2020, 1, 6),
                datetime.date(2020, 1, 13), datetime.date(2020, 1, 20),
                datetime.date(2020, 1, 27), datetime.date(2020, 2, 3),
                datetime.date(2020, 2, 10)], dtype=object),
    'y': array([[ 790],
                [1115],
                [1159],
                [ 883],
                [1018],
                [1166],
                [ 804]]),
    'yaxis': 'y'
}), Scatter({
    'mode': 'lines',
    'name': 'Trace2',
    'x': array([datetime.date(2019, 12, 30), datetime.date(2020, 1, 6),
                datetime.date(2020, 1, 13), datetime.date(2020, 1, 20),
                datetime.date(2020, 1, 27), datetime.date(2020, 2, 3),
                datetime.date(2020, 2, 10)], dtype=object),
    'y': array([[  0],
                [  0],
                [  0],
                [  0],
                [  0],
                [716],
                [890]]),
    'yaxis': 'y'
})], 'layout': Layout({
    'autosize': False,
    'legend': {'orientation': 'h'},
    'margin': {'b': 30, 'l': 20, 'r': 0, 't': 20},
    'showlegend': True,
    'xaxis': {'autorange': True, 'showline': True, 'type': 'date'},
    'yaxis': {'autorange': True, 'showgrid': True, 'showline': True, 'zeroline': False}
})}

When I run the app I am not seeing any of the data points on the chart and my x axis appears to be in milliseconds (I have tried both datetime and date only objects with the same result):

Screenshot 2020-02-20 at 11.18.09

Can anyone spot where I’m going wrong with this?

TIA

after posting the above I noticed the rouge dtype=object in my x values

But having now remove that I am still seeing the same output with my x & y from the figure looking like this:

'x': [2019-12-30, 2020-01-06, 2020-01-13, 2020-01-20, 2020-01-27, 2020-02-03,
          2020-02-10],
    'y': array([[  0],
                [  0],
                [  0],
                [  0],
                [  0],
                [716],
                [890]]),

Ok solved it - my y’s are arrays and using np.flatten() solved it