{"action":"created","issue":{"url":"https://api.github.com/repos/dsten/datascience/issues/83","labels_url":"https://api.github.com/repos/dsten/datascience/issues/83/labels{/name}","comments_url":"https://api.github.com/repos/dsten/datascience/issues/83/comments","events_url":"https://api.github.com/repos/dsten/datascience/issues/83/events","html_url":"https://github.com/dsten/datascience/issues/83","id":108443866,"number":83,"title":"Histograms should be a computational object","user":{"login":"davidwagner","id":3349841,"avatar_url":"https://avatars.githubusercontent.com/u/3349841?v=3","gravatar_id":"","url":"https://api.github.com/users/davidwagner","html_url":"https://github.com/davidwagner","followers_url":"https://api.github.com/users/davidwagner/followers","following_url":"https://api.github.com/users/davidwagner/following{/other_user}","gists_url":"https://api.github.com/users/davidwagner/gists{/gist_id}","starred_url":"https://api.github.com/users/davidwagner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidwagner/subscriptions","organizations_url":"https://api.github.com/users/davidwagner/orgs","repos_url":"https://api.github.com/users/davidwagner/repos","events_url":"https://api.github.com/users/davidwagner/events{/privacy}","received_events_url":"https://api.github.com/users/davidwagner/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dsten/datascience/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-26T06:23:25Z","updated_at":"2015-10-03T01:46:41Z","closed_at":"2015-10-03T01:46:41Z","body":"Right now, a histogram is a picture.  All you can do with it is display it, but you can't manipulate it programmatically.\r\n\r\nOne of the principles in this class is that histograms are how we think about distributions; they are our stand-in for a distribution (especially an empirical distribution).  It seems like it might be useful to make a histogram a computational object, one that can be programmatically accessed and operated on.\r\n\r\nIn particular, it seems like it might be elegant to think of a histogram as a table with one row per bin and two columns: one identifying the bin, one with the frequency/count/probability for that bin.  I suggest that we have two methods: one that computes a histogram-table from a table (binning things etc.), and another that plots a histogram-table visually.\r\n\r\nHere's one example of a candidate design:\r\n\r\n    Table.histogram(column_label, bins=None, counts=None, **vargs)\r\n        Bins the values in the specified column, and returns a HistogramTable for them.\r\n        vargs can be bins=..., range=..., normed=... (True by default)\r\n\r\n    HistogramTable.display(**vargs)\r\n        Plots the histogram and makes a picture.\r\n        vargs might contain variable options that control the layout of the picture, e.g., color=....\r\n\r\nHistogramTable is a subclass of Table with two columns, 'value' and 'probability', and all the usual methods -- it can be treated just like a table -- but it also supports the extra method display() to make a picture.  (Or maybe three columns, 'left endpoint' and 'right endpoint' and 'probability'?)\r\n\r\nThis would let you do something like tbl.histogram(...).display(...) to get a picture, but also let you do tbl.histogram(...) to get a histogram that you can work with programmatically: compute variation distance on, draw samples from, etc."},"comment":{"url":"https://api.github.com/repos/dsten/datascience/issues/comments/145192645","html_url":"https://github.com/dsten/datascience/issues/83#issuecomment-145192645","issue_url":"https://api.github.com/repos/dsten/datascience/issues/83","id":145192645,"user":{"login":"papajohn","id":320145,"avatar_url":"https://avatars.githubusercontent.com/u/320145?v=3","gravatar_id":"","url":"https://api.github.com/users/papajohn","html_url":"https://github.com/papajohn","followers_url":"https://api.github.com/users/papajohn/followers","following_url":"https://api.github.com/users/papajohn/following{/other_user}","gists_url":"https://api.github.com/users/papajohn/gists{/gist_id}","starred_url":"https://api.github.com/users/papajohn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/papajohn/subscriptions","organizations_url":"https://api.github.com/users/papajohn/orgs","repos_url":"https://api.github.com/users/papajohn/repos","events_url":"https://api.github.com/users/papajohn/events{/privacy}","received_events_url":"https://api.github.com/users/papajohn/received_events","type":"User","site_admin":false},"created_at":"2015-10-03T01:46:41Z","updated_at":"2015-10-03T01:46:41Z","body":"I think `bin` and the new `counts` option of `hist` does the trick, so closing the issue. If it's not what you want, then feel free to re-open."}}