# Working with PDB Column type in Python Script nodes

**URL:** <https://forum.knime.com/t/working-with-pdb-column-type-in-python-script-nodes/89869>\
**Category:** KNIME Extensions\
**Tags:** scripting, python\
**Created:** [September 11, 2025, 5:11pm UTC](https://forum.knime.com/t/working-with-pdb-column-type-in-python-script-nodes/89869 "2025-09-11T17:11:00Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![s.roughley](https://forum-cdn.knime.com/user_avatar/forum.knime.com/s.roughley/32/366_2.png) [@s.roughley](https://forum.knime.com/u/s.roughley)\
**Post date:** [September 12, 2025, 12:43pm UTC](https://forum.knime.com/t/working-with-pdb-column-type-in-python-script-nodes/89869/2 "2025-09-12T12:43:21Z")

</div>

OK, I answer my own question after a lot of trial and error and maybe a few lucky leaps from [this](https://forum.knime.com/t/announcing-the-interoperability-between-rdkit-and-python-in-knime-4-7/60416) super-useful post from @carstenhaubold

For anyone else looking in the future (probably me, but someone else must do this sort of thing right?!)

```python
import knime.scripting.io as knio
import knime.types.biology as kbio

df = knio.input_tables[0].to_pandas()

rowCount = knio.input_tables[0].num_rows

output_pdbs = []

for rowIdx in range(rowCount):
    # Seems I can use this directly as a String
    input_pdb = df['PDB'][rowIdx]
    output_pdb_str = do_some_stuff_to_pdb(input_pdb)
    output_pdb = None if output_pdb_str is None else knio.PdbValue(output_pdb_str)
    output_pdbs.append(output_pdb)

df['new pdb column'] = output_pdbs
knio.output_tables[0] = knio.Table.from_pandas(df)

```

(If anyone wants to improve my python-speak, suggestions welcome!)

Steve

---

_[View the full topic](https://forum.knime.com/t/working-with-pdb-column-type-in-python-script-nodes/89869)._
