I’m trying to plot a time series using plotly express line chart. The data frame has 2 column index levels:
Variable Futures VIX9D_Basis … VIX3M_Basis GVZ_Basis
1.0 1.5 1.5 2.0 3.0 4.0 5.0 6.0 1.0 1.5 … 5.0 6.0 1.0 1.5 1.5 2.0 3.0 4.0 5.0 6.0
Trade Date
The top level is a string, the 2nd level is an integer.
When I try to plot one of the columns:
fig1 = px.line(vix_basis, x=vix_basis.index, y=(‘VIX_Basis’, ‘1.0’), title=‘VIX basis’)
fig.show()
I get the error message:
All arguments should have the same length. The length of argument
y
is 2, whereas the length of previously-processed arguments [‘Trade Date’] is 5007
Please note ‘Trade Date’ is the index column.
Why is plotly not able to pull the full column for the y axis? Is the fact that there is an integer as the 2nd level column name messing it up? Thanks!