[Numpy-discussion] Crosstabulation

Friedrich Romstedt friedrichromstedt@gmail....
Thu Jul 22 17:42:06 CDT 2010


2010/7/20 Vincent Schut <schut@sarvision.nl>:
> slope_bin_edges = [0, 3, 15, 35]
> landuse_bin_edges = [0, 1, 2, 3]
> crosstab = numpy.histogram2d(landuse, slope, bins=(landuse_bin_edges,
> slope_bin_edges))

I like it!  I guess the actual bins are [0, 3), [3, 15) and [15, 35)?
>From the docs, that is not so clear.  Either way, the 35 or the 0
would be an outlier.  So maybe it's better to specifiy a somewhat
enlarged end boundary.  (And, of course, for the integer landuse data
bin edges [-0.5, 1.5, ..., 3.5] may be best.)

Friedrich


More information about the NumPy-Discussion mailing list