To easily share a sample dataframe using df.to_dict() with Python Pandas, we can split a dataframe with 'split'
with calling to_dict
.
For instance, we write
import plotly.express as px
df = px.data.iris().head(10)
df.to_dict('split')
to call to_dict
on our dataframe with 'split'
to return a data frame that has some of the rows that’s in the data frame.