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
# python - Find column whose name contains a specific string - Stack Overflow
v_colums_to_filter = [col for col in input_table.columns if ‘<span’ in col]

# Python Pandas : Drop columns in DataFrame by label Names or by Index Positions - thisPointer

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)

1 Like