Identify the axis error when marginalizing a joint probability table.
Codepython
import numpy as np
# Joint distribution P(X, Y); rows = X, cols = Y
joint = np.array([[0.1, 0.2],
[0.3, 0.4]])
# Marginal P(X): sum over Y for each value of X
p_x = joint.sum(axis=0)
print(p_x) # expected one probability per X value