{"action":"created","issue":{"url":"https://api.github.com/repos/altair-viz/altair/issues/626","repository_url":"https://api.github.com/repos/altair-viz/altair","labels_url":"https://api.github.com/repos/altair-viz/altair/issues/626/labels{/name}","comments_url":"https://api.github.com/repos/altair-viz/altair/issues/626/comments","events_url":"https://api.github.com/repos/altair-viz/altair/issues/626/events","html_url":"https://github.com/altair-viz/altair/issues/626","id":307331600,"number":626,"title":"LookupData doesn't handle DataFrame","user":{"login":"ellisonbg","id":27600,"avatar_url":"https://avatars3.githubusercontent.com/u/27600?v=4","gravatar_id":"","url":"https://api.github.com/users/ellisonbg","html_url":"https://github.com/ellisonbg","followers_url":"https://api.github.com/users/ellisonbg/followers","following_url":"https://api.github.com/users/ellisonbg/following{/other_user}","gists_url":"https://api.github.com/users/ellisonbg/gists{/gist_id}","starred_url":"https://api.github.com/users/ellisonbg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ellisonbg/subscriptions","organizations_url":"https://api.github.com/users/ellisonbg/orgs","repos_url":"https://api.github.com/users/ellisonbg/repos","events_url":"https://api.github.com/users/ellisonbg/events{/privacy}","received_events_url":"https://api.github.com/users/ellisonbg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-21T16:53:49Z","updated_at":"2018-03-21T17:15:59Z","closed_at":null,"author_association":"COLLABORATOR","body":"A student was trying to do a geographic map with countries mapped to color. He found that he couldn't get this example:\r\n\r\nhttps://altair-viz.github.io/gallery/choropleth.html\r\n\r\nworking with a DataFrame rather than a URL. The issue is that our `LookupData` object doesn't use the data transformer pipeline to properly handle a DataFrame argument. The following code did work:\r\n\r\n```python\r\ncountries = alt.topo_feature(data.world_110m.url,'countries')\r\ncountry_ses = pd.read_csv('/data/country_ses.csv')\r\ncountry_values = alt.pipe(country_ses[['id', 'ses']], alt.to_values)\r\n\r\nchart = alt.Chart(countries).mark_geoshape().properties(\r\n    projection={'type': 'equirectangular'},\r\n    width=500,\r\n    height=300\r\n).encode(\r\n    color='ses:Q'\r\n).transform_lookup(\r\n    lookup='id',\r\n    from_=alt.LookupData(country_values, 'id', ['ses'])\r\n)\r\nchart\r\n```\r\n\r\nShould be an easy fix for `LookupData` to use the data transformers. Are there other parts of the API where we are not fully handling DataFrames?"},"comment":{"url":"https://api.github.com/repos/altair-viz/altair/issues/comments/375023845","html_url":"https://github.com/altair-viz/altair/issues/626#issuecomment-375023845","issue_url":"https://api.github.com/repos/altair-viz/altair/issues/626","id":375023845,"user":{"login":"jakevdp","id":781659,"avatar_url":"https://avatars0.githubusercontent.com/u/781659?v=4","gravatar_id":"","url":"https://api.github.com/users/jakevdp","html_url":"https://github.com/jakevdp","followers_url":"https://api.github.com/users/jakevdp/followers","following_url":"https://api.github.com/users/jakevdp/following{/other_user}","gists_url":"https://api.github.com/users/jakevdp/gists{/gist_id}","starred_url":"https://api.github.com/users/jakevdp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakevdp/subscriptions","organizations_url":"https://api.github.com/users/jakevdp/orgs","repos_url":"https://api.github.com/users/jakevdp/repos","events_url":"https://api.github.com/users/jakevdp/events{/privacy}","received_events_url":"https://api.github.com/users/jakevdp/received_events","type":"User","site_admin":false},"created_at":"2018-03-21T17:15:59Z","updated_at":"2018-03-21T17:15:59Z","author_association":"OWNER","body":"Good catch... I think what we need is for ``LookupData()`` to handle data inputs the same way that top-level methods do.\r\n\r\nI'm not sure if there are other places where this would come up, but I'll take a look through the schema to see if I can find any."}}
{"actor":{"display_login":"jakevdp"}}