Plotly code sample to handle large NumPy arrays or Panda Dataframe

I need to implement a chart very similar to the following sample. My chart supposed to visualize market data in a large Pandas dataframe:

Above sample includes the following code:

fig.add_trace( go.Scatter(x=list(df.Date), y=list(df.High)))

The code snippet coverts dataframe’s columns to lists. It is quite inefficient when the dataframe has a large number of columns.

Is there anyway that I use Ployly with large Numpy arrays without converging them to lists?

Thank you,


import numpy as np
import pandas as pd
import plotly.graph_objects as go

df = pd.DataFrame({"x": np.arange(10), "y": np.arrange(10) ** 2})

fig = go.Figure(data=go.Scatter(x=df["x"], y=df["y"]))

This is helpful, thank you.

Is it safe to assume that the code sample I mentioned should be improved and not to convert the Dataframe’s columns to list because it just duplicate the memory without any benefit?