I need to implement a chart very similar to the following sample. My chart supposed to visualize market data in a large Pandas dataframe:
Detailed examples of Range Slider and Selector including changing color, size, log axes, and more in Python.
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,
stu
April 9, 2022, 4:19am
2
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"]))
fig.show()
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?