Last active
January 29, 2018 17:16
-
-
Save Zsailer/f42df4317f7bfcd93a0791d7dc432791 to your computer and use it in GitHub Desktop.
post-1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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