data-8 / datascience

A Python library for introductory data science
BSD 3-Clause "New" or "Revised" License
613 stars 289 forks source link

map_table seems backwards #82

Closed deculler closed 8 years ago

deculler commented 8 years ago

Maps should function relative to tables just like matplotlib. Tables builds on it, not the other way around. It provides lower level capabilities that are easily accessed through tables. Table.point was an example - which now invokes Circle.map so it works again. It allows the latitude and longitude columns to be named or provided as arrays - just like the rest of tables. The assumption made by map_table that the first two columns have these semantics - clearly a very poor abstraction - is an indication why the reversal of the relationship is backwards.

papajohn commented 8 years ago

Hmm, I don't think table.py or any method on a Table should know what a map is. Tables are containers; they're agnostic to the semantics of their contents.

For convenience, we either need Marker.map_table or Table.points (but not both), and the former seems to respect the separation that tables contain stuff and map features know how to draw maps.

deculler commented 8 years ago

Clearly not both. And good to have the discussion. I recognize that there are two views here. At the risk of being redundant of my previous post, walk me through the argument for how map us different from plot or hist. Table provides a limited set of visualization capabilities. Is Geo so different? When you need more, go directly to the library. But within Tables you have some of what you would expect of a spreadsheet, and that includes basic viz. I can't see how maps should reach back up into tables. It should stand alone like pyplot. As far as I see it, the only special thing about maps is that we wrote it - and did a nice job and it could be a shim for a variety of GIS engines. Table.method just provides a way into a useful subset of what is there through the container.

BTW it would be good to take a look at scatter. It is very close to the line if what you can reasonably do at the Tables level of abstraction without dropping down into pyplot. I was tempted to throw in a color-column. The demo shows why that would be nice. But... On Oct 2, 2015 9:49 PM, "John DeNero" notifications@github.com wrote:

Hmm, I don't think table.py or any method on a Table should know what a map is. Tables are containers; they're agnostic to the semantics of their contents.

For convenience, we either need Marker.map_table or Table.points (but not both), and the former seems to respect the separation that tables contain stuff and map features know how to draw maps.

— Reply to this email directly or view it on GitHub https://github.com/dsten/datascience/issues/82#issuecomment-145192868.

papajohn commented 8 years ago

Geo is different from histograms & scatter plots because it assigns a meaning to each value (units & interpretation).

As for maps standing alone — there's not much there. The folium module stands alone, and most of datascience.maps is a bridge to make it play nicely with tables.