Skip to content

[BUG] Dash 2.1 - DataTable not accepting correct positional arguments #1844

@LiamConnors

Description

@LiamConnors
  • replace the result of pip list | grep dash below
dash                 2.1.0

Describe the Bug
The changelog says
Rearranged Keyword Arguments - data and columns the first two keyword arguments which means they can be supplied as positional arguments without the keyword.

But the following code, based on the example in the changelog under Datatable, throws an error.

import pandas as pd

df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')

app = Dash(__name__)

app.layout = dash_table.DataTable(df.to_dict('records'),id='table')

if __name__ == '__main__':
    app.run_server(debug=True)

Error:

Invalid argument `active_cell` passed into DataTable with ID "table".
Expected `object`.
Was supplied type `array`.
Value provided: 
[
  {
    "Average MW Per Plant": 15.3,
    "Generation (GWh)": 10826,
    "Installed Capacity (MW)": 4395,
    "Number of Solar Plants": 289,
    "State": "California"
  },
  {
    "Average MW Per Plant": 22.5,
    "Generation (GWh)": 2550,
    "Installed Capacity (MW)": 1078,
    "Number of Solar Plants": 48,
    "State": "Arizona"
  },.....

Expected behavior
That based on the position of the argument, this would be taken as the data and columns would be generated from the first row.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions