text_plain_output_1.png
import pandas as pd

table = pd.DataFrame({'Heads': [0.15, 0.9], 'Tails': [3.32, 0.1]}, index=['S(x)', 'P(x)'])
table

Entropy = table.loc['P(x)', 'Heads'] * table.loc['S(x)', 'Heads'] + table.loc['P(x)', 'Tails'] * table.loc['S(x)', 'Heads']
Entropy