Table function changing dates (-1) from Pandas DataFrame upon execution
See original GitHub issueHello,
I am using DataPane to create a simple report to track historical metric values, day over day. The data is being read in via Pandas excel function to a DataFrame and then I am creating a graph in plotly to visualize it. I am trying to leverage the table function in DataPane to also give the raw data along with the graph. I noticed that the dates are shifting with respect to the data. The first date in my file is September 1st, yet it is shifting everything back 1 day so that the start date of the RAW Data table output is August 31st.
Does anyone see anything that I can do, or is this a potential bug? I know i could probably convert the dates to a string, but it seems like i shouldn’t have to do that if the table function is going to assume data types.
` import pandas as pd import datapane as dp import plotly.graph_objects as go import plotly.io as pio
HistoricalData = pd.read_excel(r’mypath\DataPaneTest.xlsx’) HistoricalData[‘DataDate’] = HistoricalData[‘DataDate’].astype(‘datetime64[ns]’)
pio.templates.default = “plotly_dark”
fig = go.Figure() fig.add_trace(go.Scatter(x=HistoricalData[‘DataDate’], y=HistoricalData[‘col1’], mode=‘lines+markers’, name=‘t1’)) fig.add_trace(go.Scatter(x=HistoricalData[‘DataDate’], y=HistoricalData[‘col2’], mode=‘lines+markers’, name=‘t2’)) fig.add_trace(go.Scatter(x=HistoricalData[‘DataDate’], y=HistoricalData[‘col3’], mode=‘lines+markers’, name=‘t3’)) fig.add_trace(go.Scatter(x=HistoricalData[‘DataDate’], y=HistoricalData[‘col4’], mode=‘lines+markers’, name=‘t4’)) fig.update_layout( title_text=‘t0’,title_x=0.5)
dp.Report( dp.Markdown(“# Stuff”), dp.Markdown(" “), dp.Plot(fig), dp.Markdown(” “), dp.Markdown(”## RAW Data"), dp.Table(HistoricalData)
).save(path=r’mypath\DataPaneTest.html’, open=True) `
_Originally posted by @JCP281 in https://github.com/datapane/datapane/discussions/39_
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
Awesome. Thanks @Buroni and @mands.
You both rock!
Thanks for raising this - we’re planning on digging into the date handling and the table component as a whole next week, I think it may be related to some JS timezone handing in our table report code but we’ll fix it very shortly as a few users have had issues with dates.
In the meantime, I can suggest converting to a string until the fix comes out - so sorry for the inconvenience!