human
check if column exists.
assistant
Here is a Python function to check if a column exists

import pandas as pd

def _check_column_exists(df, column):
    """Check if column exists in the dataframe."""
    return df.columns.isin([column]).any()

# Enter the dataframe
df = pd.DataFrame({'col1': [1, 2, 3], 'col2': [4, 5, 6]})

# Calling the function
print((_check_column_exists(df, 'col1')))

#Example Output
# True

#Remember to inspect code for bugs.