Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Pandas NA type causing serialization errors

In general it looks like the new pandas NA value (see Working with missing data — pandas 1.3.4 documentation) is not handled well by Dash. Here’s a simple example

import dash
from dash import dcc
from dash import html
import plotly.graph_objs as go
import pandas as pd
import numpy as np

app = dash.Dash(__name__)

df = pd.DataFrame({'x':list('aaabbbccc'),'y':np.arange(9)})

##this is handled totally fine

##this next line will cause a serialization error

fig = go.Figure()

app.layout = html.Div(children=[

if __name__ == '__main__':

This happens for me both in graphs and in datatables, and probably other places too. Here’s another link to the same issue with a datatable How to work with pandas NAType in DataTable

The workaround for me is just not to use the new pandas dtypes, and use np.nan for null everywhere. But it would be nice to take advantage of some of the new pandas functionality (which, while clearly marked “Experimental” is not all that new any more).