Skip to content

Instantly share code, notes, and snippets.

@Zsailer
Last active January 29, 2018 17:16
Show Gist options
  • Save Zsailer/f42df4317f7bfcd93a0791d7dc432791 to your computer and use it in GitHub Desktop.
Save Zsailer/f42df4317f7bfcd93a0791d7dc432791 to your computer and use it in GitHub Desktop.
post-1
import pandas as pd
import pandas_flavor as pf
@pf.registor_dataframe_method
def check_columns(df):
# Required columns
required_cols = {'x', 'y', 'z'}
# Find columns missing from
if required_cols.issubset(df.columns) is False:
raise Exception('DataFrame is missing required columns. '
'Must have {}'.format(required_cols))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment