# Re-importing necessary libraries and reloading the data import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import itertools # Function to determine if a column is binary def is_binary(column): return sorted(column.unique()) == [0, 1] # Identifying binary columns binary_columns = [col for col in data.columns if is_binary(data[col])] print(binary_columns) for i in range(1, len(binary_columns)): binary_col1, binary_col2 = binary_columns[0], binary_columns[i] # Creating a crosstab ct = pd.crosstab(data[binary_col1], data[binary_col2]) # Plotting the heatmap for this specific crosstab plt.figure(figsize=(10, 8)) sns.heatmap(ct, annot=True, fmt='d', cmap='viridis') plt.title(f'Crosstab of {binary_col1} vs {binary_col2}') plt.ylabel(binary_col1) plt.xlabel(binary_col2) plt.show()