# Dash DataTable - Generate new table via callbacks

**URL:** <https://community.plotly.com/t/dash-datatable-generate-new-table-via-callbacks/6457>\
**Category:** Dash Python\
**Created:** [October 24, 2017, 6:23am UTC](https://community.plotly.com/t/dash-datatable-generate-new-table-via-callbacks/6457 "2017-10-24T06:23:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kyleabeauchamp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/kyleabeauchamp/32/1982_2.png) [@kyleabeauchamp](https://community.plotly.com/u/kyleabeauchamp)\
**Post date:** [October 24, 2017, 6:23am UTC](https://community.plotly.com/t/dash-datatable-generate-new-table-via-callbacks/6457/1 "2017-10-24T06:23:45Z")

</div>

I’m looking to take an editable input DataFrame, use it as input to a @callback function that generates a new DataFrame (via groupby), display the second DataFrame, and plot some bar graphs from the second DataFrame. Does anyone have any good examples of this? I keep running into the “Error loading dependencies”, which I presume is a euphemism for novice user error.

---

<div class="post-metadata">

**Author:** ![kyleabeauchamp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/kyleabeauchamp/32/1982_2.png) [@kyleabeauchamp](https://community.plotly.com/u/kyleabeauchamp)\
**Post date:** [October 24, 2017, 6:40am UTC](https://community.plotly.com/t/dash-datatable-generate-new-table-via-callbacks/6457/2 "2017-10-24T06:40:08Z")

</div>

I think a partial solution is adding an empty rows object in the generated DataFrame, as suggested by HansG in the other post: [Display tables in Dash](https://community.plotly.com/t/display-tables-in-dash/4707/41)

e.g. `rows=[{}],`

---

<div class="post-metadata">

**Author:** ![chriddyp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/chriddyp/32/16855_2.png) [@chriddyp](https://community.plotly.com/u/chriddyp)\
**Post date:** [October 27, 2017, 8:12pm UTC](https://community.plotly.com/t/dash-datatable-generate-new-table-via-callbacks/6457/3 "2017-10-27T20:12:56Z")

</div>

I just posted an example of a table generated by a callback here: [Dash DataTable - Updating the Number of Rows](https://community.plotly.com/t/dash-datatable-updating-the-number-of-rows/6448/2?u=chriddyp)

---

<div class="post-metadata">

**Author:** ![sriotti](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@sriotti](https://community.plotly.com/u/sriotti)\
**Post date:** [June 22, 2018, 3:30am UTC](https://community.plotly.com/t/dash-datatable-generate-new-table-via-callbacks/6457/4 "2018-06-22T03:30:41Z")

</div>

Did you ever find a solution of how to take an editable input DataFrame, use it as input to a @callback function that generates a new DataFrame (via groupby), display the second DataFrame?

---

<div class="post-metadata">

**Author:** ![kyleabeauchamp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/kyleabeauchamp/32/1982_2.png) [@kyleabeauchamp](https://community.plotly.com/u/kyleabeauchamp)\
**Post date:** [June 22, 2018, 5:59am UTC](https://community.plotly.com/t/dash-datatable-generate-new-table-via-callbacks/6457/5 "2018-06-22T05:59:47Z")

</div>

I think I pieced something together from the various examples in the forum. However, my code is currently defunct because it uses the old Tabs functionality and I need to port to the new version of Tabs.

---

<div class="post-metadata">

**Author:** ![sriotti](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@sriotti](https://community.plotly.com/u/sriotti)\
**Post date:** [June 22, 2018, 3:00pm UTC](https://community.plotly.com/t/dash-datatable-generate-new-table-via-callbacks/6457/6 "2018-06-22T15:00:08Z")

</div>

How did you get it to work? What i am looking to do by clicking a button:

1. Send a datatable’s rows to a new pandas dataframe, then
2. Run some analytics on that pandas dataframe by calling a function, returning a new pandas dataframe (results\_df), then
3. Create a new datatable from results\_df from step 2.

After uploading raw data and creating the input datatable below, how do i do steps 1-3 above? Any guidance would be much appreciated.

```
dt.DataTable( id='input datatable',
                            rows=model_input_df.to_dict('records'),
                            row_selectable=True,
                            filterable=True,
                            sortable=True,
                            )
```

---

<div class="post-metadata">

**Author:** ![sparrow](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@sparrow](https://community.plotly.com/u/sparrow)\
**Post date:** [March 20, 2019, 8:52pm UTC](https://community.plotly.com/t/dash-datatable-generate-new-table-via-callbacks/6457/7 "2019-03-20T20:52:42Z")

</div>

Did anyone ever find a solution for this?

---

<div class="post-metadata">

**Author:** ![wguicheney](https://avatars.discourse-cdn.com/v4/letter/w/e19adc/32.png) [@wguicheney](https://community.plotly.com/u/wguicheney)\
**Post date:** [December 10, 2019, 5:34pm UTC](https://community.plotly.com/t/dash-datatable-generate-new-table-via-callbacks/6457/8 "2019-12-10T17:34:49Z")

</div>

Hi guys,

I’m currently trying to do this as well. I have a callback that currently generates a DataTable, and I need to allow a user to select one row, click some button (or the row itself, doesn’t matter), and for that to generate a new DataTable.  
For additional context, the row would get converted to a dataframe used to generate a SQL query, and that would then pull a fresh set of data to feed into the new table.

Any help would be appreciated!
