can anyone help the Texas map example

Hi folks, I am new and looking for a tool to generate a USA map.

I came across this Texas map example. I would like to do some

research and generate a similar map with my own data. Can anyone tell

me how to access this two data ( us_counties, unemployment).

It looks the head() function does not work

Thanks in advance

Jason

from bokeh.sampledata import us_counties, unemployment

Hi Jason,

I apologize but it's been awhile, so I don't recall the data format of that very well. It was thrown together fairly quickly to get that demo showing. A little poking reveals that

  bokeh.sampledata.us_counties.data

is a plain python dict. It is indexed by some tuple of id's for each county (I definitely don't remember what the id's are from). For each county-tuple-id is another dict that has the data for each county. It looks like this:
  
  In [31]: us_counties.data[(5,51)].keys()
  Out[31]: dict_keys(['lats', 'name', 'lons', 'state'])

So for every county, there is a name, a state and two lists, one for latitudes, and one for longitudes.

I hope that is enough info to get you going.

Thanks,

Bryan

···

On Apr 18, 2016, at 8:52 PM, Jason Li <[email protected]> wrote:

Hi folks, I am new and looking for a tool to generate a USA map.
I came across this Texas map example. I would like to do some
research and generate a similar map with my own data. Can anyone tell
me how to access this two data ( us_counties, unemployment).
It looks the head() function does not work
Thanks in advance

Jason

from bokeh.sampledata import us_counties, unemployment

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0dd82bd9-6e9b-4c89-8462-48e3d0ba8b7a%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Bryan,

Thank you so much for the information so that I could convert the dict as Dataframe.

Jason

···

On Mon, Apr 18, 2016 at 10:15 PM, Bryan Van de Ven [email protected] wrote:

Hi Jason,

I apologize but it’s been awhile, so I don’t recall the data format of that very well. It was thrown together fairly quickly to get that demo showing. A little poking reveals that

    bokeh.sampledata.us_counties.data

is a plain python dict. It is indexed by some tuple of id’s for each county (I definitely don’t remember what the id’s are from). For each county-tuple-id is another dict that has the data for each county. It looks like this:

    In [31]: us_counties.data[(5,51)].keys()

    Out[31]: dict_keys(['lats', 'name', 'lons', 'state'])

So for every county, there is a name, a state and two lists, one for latitudes, and one for longitudes.

I hope that is enough info to get you going.

Thanks,

Bryan

On Apr 18, 2016, at 8:52 PM, Jason Li [email protected] wrote:

Hi folks, I am new and looking for a tool to generate a USA map.

I came across this Texas map example. I would like to do some

research and generate a similar map with my own data. Can anyone tell

me how to access this two data ( us_counties, unemployment).

It looks the head() function does not work

Thanks in advance

Jason

from bokeh.sampledata import us_counties, unemployment

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0dd82bd9-6e9b-4c89-8462-48e3d0ba8b7a%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/BF011B8F-D12D-41A2-829E-69F4EA81DDD5%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

No problem, and I agree a dataframe is a much better and simpler format for the data. The reason we kept it as a dict is that we are trying to minimize the external dependencies. Right now pandas is optional, and only required if you want to use bokeh.charts API.

Bryan

···

On Apr 18, 2016, at 9:40 PM, Jason Li <[email protected]> wrote:

Hi Bryan,

Thank you so much for the information so that I could convert the dict as Dataframe.

Jason

On Mon, Apr 18, 2016 at 10:15 PM, Bryan Van de Ven <[email protected]> wrote:
Hi Jason,

I apologize but it's been awhile, so I don't recall the data format of that very well. It was thrown together fairly quickly to get that demo showing. A little poking reveals that

        bokeh.sampledata.us_counties.data

is a plain python dict. It is indexed by some tuple of id's for each county (I definitely don't remember what the id's are from). For each county-tuple-id is another dict that has the data for each county. It looks like this:

        In [31]: us_counties.data[(5,51)].keys()
        Out[31]: dict_keys(['lats', 'name', 'lons', 'state'])

So for every county, there is a name, a state and two lists, one for latitudes, and one for longitudes.

I hope that is enough info to get you going.

Thanks,

Bryan

> On Apr 18, 2016, at 8:52 PM, Jason Li <[email protected]> wrote:
>
> Hi folks, I am new and looking for a tool to generate a USA map.
> I came across this Texas map example. I would like to do some
> research and generate a similar map with my own data. Can anyone tell
> me how to access this two data ( us_counties, unemployment).
> It looks the head() function does not work
> Thanks in advance
>
> Jason
>
> from bokeh.sampledata import us_counties, unemployment
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0dd82bd9-6e9b-4c89-8462-48e3d0ba8b7a%40continuum.io.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/BF011B8F-D12D-41A2-829E-69F4EA81DDD5%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CALpcxh4Bra2%2B%3D23nxgRC3usr_%3D%3DNptvtkAXKLvm%3Dja5E4vprUA%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.