Exclude sample pairs with identical x coordinates?
According to https://en.wikipedia.org/wiki/Theil%E2%80%93Sen_estimator, "In Sen's definition, one takes the median of the slopes defined only from pairs of points having distinct x coordinates", citing "Sen, Pranab Kumar (1968), "Estimates of the regression coefficient based on Kendall's tau", Journal of the American".
SciPy version indeed excludes repetitions of x values, see https://github.com/scipy/scipy/blob/v1.9.0/scipy/stats/_stats_mstats_common.py#L331.
In case the original sources agree, this should be added here, too.