I was self learning about entropy and came across this equation. $$ H = - \sum p(x) \log p(x) $$
The equation for entropy in expected value, $$ H(x) = \operatorname*{\mathbb{E}}_{X \sim P}[I(x)] = -\operatorname*{\mathbb{E}}_{X \sim P}[\log P(x)]. $$
But the expected value is written as
$$ \mathbb{E}[X] = \sum_{i=1}^k x_i p_i = x_1p_1 + x_2p_2 + \cdots + x_k p_k $$
Using the above expected value formula, I expected the entropy equation looks something like this
$$H(x)= -\operatorname*{\mathbb{E}}_{x \sim P(x)}[\log P(x)]= - \sum xP(x)\log P(x) $$
where is the $x$ gone in the real entropy formula in summation notation?