Sdrds
import numpy as np import pandas as pd from math import log2 # Load the dataset df=pd.read_csv(‘tennisdata.csv’) #Make sure the file is in the same folder print(df) # Function to calculate entropy def calculate_entropy(data_column): counts = data_column.value_counts() probabilities= counts / len(data_column) entropy=-sum(probabilities* np.log2(probabilities)) return entropy # Function to calculate information gain def…