0

In an excel spreadsheet with four sheets (this is an A/B test, Sheet 1 is a_group_flights, Sheet 2 is b_group_flights, Sheet 3 is a_group_hotels, Sheet 4 is b_group_hotels), I'm interested in plotting two of the columns "budget_price" and "total_spend" over a time period shown by "budget_datetime" and have those two lines (budget_price and total_spend) overlap to show the difference between what your budget is and how much you're actually spending over time on trips.

This is what the spreadsheet looks like: https://ibb.co/JHCf12z

I am using Dash Plotly and want to read the excel spreadsheet with Pandas, and then plot the data on a graph.

xlsx = pd.ExcelFile('data.xlsx')

1 Answer 1

1

Read the excel instead with

xlsx = pd.read_excel('your_excel_file.xls') 

To make a simple line plot just make

df = xlsx
data = [go.Scatter( x=df['X_axis_column'], y=df['first_y_data', 'second_y_data'] )]

If your excel has more than one sheet, just make

df1 = pd.read_excel('exel_file.xls', 'Sheet1')
df2 = pd.read_excel('exel_file.xls', 'Sheet2')

Then you should check here to see which kind of plot you want

Sign up to request clarification or add additional context in comments.

5 Comments

How would you create a basic line chart (two lines, budget_price column, and total_spend column) vs. time (budget_datetime column)?
Also how would you iterate through each sheet in the excel file with Pandas?
I'll add the first part as an edit to the answer, not sure about the second part yet, let be find out
would that simple line plot code be added within app.layout in Dash?
You need to take a look at this, then dash.plot.ly/getting-started

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.