Mapnik's design separates the concerns of data with style, allowing styles to be arbitrarily attached to layers. Thus styles and their logic intentionally have no way to get at data values, individually (like a first value) or in aggregate (like min/max). Styles, through Rules can only filter data based on expressions.
However, for thematic mapping, particularly dynamically changing choropleths, applications using mapnik need an easy way to introspect data, and get statistics before rendering. If this were possible then aggregate statistics could be calculated once, cached, and used then to change stylesheets on the fly.
This could be done by adding new functions on the datasource class: http://trac.mapnik.org/browser/trunk/include/mapnik/datasource.hpp#L104. The current datasource class design is largely based on rendering needs, but functions could be added that accept an attribute name and statistics type request (like max or min) and return the requested value in a boost::optional object (as perhaps some queries will not be possible/efficient for some datasources).
[springmeyer] Since we're after attribute statistics mainly, this ticket is related: http://trac.mapnik.org/ticket/816
[springmeyer] see also the comment at http://trac.mapnik.org/ticket/816#comment:2 which was intended for this ticket.
First pass, a simplistic implementation that I'm testing against jit datasource, is in the statistics branch.