Data analysis labNumPy problems

Problem 26 of 50 · Broadcasting · Hard

Distances between every pair

Build a square table of absolute differences.

Preparing NumPy, Pandas, and MatplotlibShift+Enter runs the cell you are in.

For [1, 4, 6], print a 3 by 3 table where entry i, j is the absolute difference between item i and item j. Broadcast a column against a row, then take np.abs.

1

Your solution

2

Scratch