How to exclude rows if any of the columns in a dataframe contains non-binary (0 or 1) numbers. Not to exclude based on a specific column, but for all of the columns.
For example, we have a dataframe like this, and we want to delete row number 0, 2 and 4.
array = [[1, 0, 0, 0, 0, 0, 2],
[1, 0, 0, 1, 0, 0, 0],
[2, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 1, 0],
[1, 0, 0, 3, 0, 0, 0]]
df = pd.DataFrame(array, columns = ['AB','AC','CB','DE','FA','CD','AF'] )