A line graph showing unintentionally showing two lines

Iโ€™m trying to plot a timeseries data from a csv with Plotly express and for some reason, itโ€™s showing an extra line connecting various points. I made a new column of the timestamp without the year, and had that as the x-values, as shown below:

df['Without_year'] = df.index.strftime('%m-%d %H:%M:%S')

fig = go.Figure()

fig = px.line(df_2019, x = 'Without_year',y = "values")

fig.show()

plotly graph

I am having this issue as well - anyone know why it is occuring? (Note- I am an exile from the land of Altairโ€ฆ)

fig = px.line(merged_df, x="period", y="value", color="series_code", title="hello")

Hi @robliou welcome to the forums.

My guess would be that your end point gets connected to the first point. I canโ€™t reproduce this with the following example, so you might share your data if possible.

import plotly.express as px
import pandas as pd
import random

# create data
days=7
timespan = pd.date_range('01/01/2022', periods=days, freq='D')
value = [np.random.randint(1,50) for _ in range(days)]

# create figure
fig = px.line(x=timespan, y=value)
fig.show()

creates:

Hi AIMPED, here is the code:

    'EIA/IEO.2021/LOWOILPRICE.SUP_LIQ_TOT_MBPD_TOT_MBPD.A',
    'EIA/IEO.2021/HIGHOILPRICE.SUP_LIQ_TOT_MBPD_TOT_MBPD.A'

], max_nb_series=70)

fig = px.line(df,  x="period", y="alt_value", color="agency_forecast",
                        title="hello"))```

On reading your comment; I suspect it might have something to do with the dataset being provided by EIA. 

Just off the top of your head, could you think of anything that would cause a second line to be drawn connecting two points?

Thank you,