  Data partitioning that maximizes or minimizes Shannon entropy is a crucial
subroutine in data compression, columnar storage, and cardinality estimation
algorithms. These partition algorithms can be accelerated if we have a data
structure to find the entropy in different subsets of data when the algorithm
needs to decide what block to construct. While it is generally known how to
compute the entropy of a discrete distribution efficiently, we want to
efficiently derive the entropy among the data items that lie in a specific
area. We solve this problem in a typical setting when we deal with real data,
where data items are geometric points and each requested area is a query
(hyper)rectangle. More specifically, we consider a set $P$ of $n$ weighted and
colored points in $\mathbb{R}^d$. The goal is to construct a low space data
structure, such that given a query (hyper)rectangle $R$, it computes the
entropy based on the colors of the points in $P\cap R$, in sublinear time. We
show a conditional lower bound for this problem proving that we cannot hope for
data structures with near-linear space and near-constant query time. Then, we
propose exact data structures for $d=1$ and $d>1$ with $o(n^{2d})$ space and
$o(n)$ query time. We also provide a tune parameter $t$ that the user can
choose to bound the asymptotic space and query time of the new data structures.
Next, we propose near linear space data structures for returning either an
additive or a multiplicative approximation of the entropy. Finally, we show how
we can use the new data structures to efficiently partition time series and
histograms with respect to entropy.
