I have the following dataframe with date stamps and 2 columns:
Gold Oil
2000-03-31 276.75 29.89
2000-06-30 288.15 31.83
I am trying to build the plotly chart where i should put the "date" as an "x" but the output gives me an error of "date" ----> not a column of dataframe as expected [Gold, Oil].
below is the graph i am trying to build:
import plotly.express as px
import pandas as pd
df = gold_data
fig = px.line(df,x='Date', y='Gold', title='GOLD Time Series with Rangeslider')
fig.update_xaxes(rangeslider_visible=True)
fig.show()
How do i add the Dates as a column to pandas dataframe so i can call it in the graph? I believe its something to do with index bit not 100% sure. Thanks for your help!