import pandas as pd # Read Excel file df = pd.read_excel(r"C:\Users\29177\Desktop\kdd-cup.xlsx") # Column name that requires unique thermal coding column_name = "Column4" # Use pandas' get_dummies function for unique thermal encoding one_hot_encoded = pd.get_dummies(df[column_name]).astype(int) # Merge the encoded results with the original data df_encoded = pd.concat([df, one_hot_encoded], axis=1) one_hot_encoded.to_excel(r"C:\Users\29177\Desktop\1.xlsx", sheet_name='1-2', index=False) # Output result print(df_encoded)