# Python Script Table Output

**URL:** <https://forum.knime.com/t/python-script-table-output/59365>\
**Category:** KNIME Analytics Platform\
**Tags:** python\
**Created:** [January 13, 2023, 7:37pm UTC](https://forum.knime.com/t/python-script-table-output/59365 "2023-01-13T19:37:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcrisnidh](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mcrisnidh/32/49502_2.png) [@mcrisnidh](https://forum.knime.com/u/mcrisnidh)\
**Post date:** [January 13, 2023, 7:37pm UTC](https://forum.knime.com/t/python-script-table-output/59365/1 "2023-01-13T19:37:09Z")

</div>

Howdy Knimers,

Im working with the Python Script node and although my code runs and the configuration view of the node shows the right output, I am missing the table output to see it and be able to work with further nodes in KNIME.

The error is “knime user error: output table ‘0’ must be of type knime.api.Table or knime.api.batch output Table but got class ‘list’”

This is my code

import [knime.scripting.io](http://knime.scripting.io) as knio

# This example script simply outputs the node’s input table.

knio.output\_tables[0] = knio.input\_tables[0]

numbers = knio.flow\_variables[‘Sorted list\*(Folio\_Import)’]

lowest = min(numbers)  
biggest = max(numbers)

print(lowest)  
print(biggest)

number\_range = range(lowest, biggest+1)  
print(list(number\_range))

## This is how my output looks inside the configuration screen

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/e/c/ece26a77e73715fe512db5c5c95be3df73857ae3.png)

## This is how it errors out from the node itself

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/1/9/1931b22c442306c057d022ce9ab7408aadefe3a5.png)

Any help is truly appreciated.

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [January 13, 2023, 10:38pm UTC](https://forum.knime.com/t/python-script-table-output/59365/2 "2023-01-13T22:38:03Z")

</div>

@mcrisnidh welcome to the knime forum.

You will have to convert your list to a [Pandas dataframe](https://www.geeksforgeeks.org/create-a-pandas-dataframe-from-lists/).

[https://docs.knime.com/latest/python\_installation\_guide/#\_configuration](https://docs.knime.com/latest/python_installation_guide/#_configuration)

Something like this

> df = pd.DataFrame(list)  
> knio.output\_tables[0] = knio.Table.from\_pandas(df)

Or

> df = pd.DataFrame(list)  
> knio.output\_tables[0] = knio.write\_table(df)

---

<div class="post-metadata">

**Author:** ![mcrisnidh](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mcrisnidh/32/49502_2.png) [@mcrisnidh](https://forum.knime.com/u/mcrisnidh)\
**Post date:** [January 16, 2023, 8:00pm UTC](https://forum.knime.com/t/python-script-table-output/59365/3 "2023-01-16T20:00:46Z")

</div>

Thank you for the information. This worked perfectly.

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [January 23, 2023, 8:01pm UTC](https://forum.knime.com/t/python-script-table-output/59365/4 "2023-01-23T20:01:16Z")

</div>

Closed on January 23, 2023, 8:01pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
