plotly / plotly/dash

bool(DashTable) is always False

Open
#2,906 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug feature P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

Describe your context

dash                      2.17.1
dash-core-components      2.0.0
dash-html-components      2.0.0
dash-table                5.0.0

Describe the bug
bool(DashTable) is always False. I can't use tb or [] for shorthand when there is no data

from dash import dash_table
df = pd.DataFrame({'a': [1, 2]})
tb = dash_table.DataTable(df.to_dict('records'), columns=[{'name': column, 'id': column} for column in df.columns])
print(bool(tb))

Expected behavior

bool(tb) evaluates to True, either always or when there is data

Screenshots

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported behavior with dash_table.DataTable and the versions listed in the issue, using the provided DataFrame example. Check how DataTable is evaluated by bool() and confirm that the result matches the expected behavior when the table contains data; done means the example no longer evaluates unexpectedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.