I am trying to filter a database table column via Python script, but when I am trying to execute it i am getting the error: output_table = input_table.copy() ^SyntaxError: invalid syntax

Not exactly sure what you want to do but in Python dropping a column might look something like this:

import pandas
# https://stackoverflow.com/questions/21285380/find-column-whose-name-contains-a-specific-string
v_colums_to_filter = [col for col in input_table.columns if ‘<span’ in col]

# https://thispointer.com/python-pandas-drop-columns-in-dataframe-by-label-names-or-by-index-positions/

input_table = input_table.drop(v_colums_to_filter , axis=‘columns’)
output_table = input_table.copy()

kn_example_python_filter_columns.knwf (8.1 KB)


Edit: KNIME Snippets (5) — Python Overview | by Markus Lauber | Low Code for Data Science | Medium

1 Like