UnicodeDecodeError: 'utf8' codec can't decode byte 0xc3 in position 19: unexpected end of data

Hello,

My pandas Dataframe contains below characters.

Names

Kiljavan Lääketutkimus

Centre Hospitalier Régional Universitaire de Montpellier

Hospital Regional Universitario de Málaga

Akdeniz Üniversitesi Hastanesi

MVZ für Rheumatologie Dr. Martin Welcker

During rendering this dataframe to bokeh charts.

It throws error - "UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xc3 in position 19: unexpected end of data"

I tried

df[“names”] = df[“names”].apply(lambda x: x.decode(‘unicode_escape’).encode(‘ascii’, ‘replace’).strip())

but it is ignore UTF-8 Characters that i dont’ want. I need to keep data intact

Any help ?

Nitin

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

When loading your df, try pd.read_csv('file', **encoding** = "**ISO**-8859-1")
(Adjusting for your source and file name).

···

On Sep 19, 2017 6:02 AM, “Nitin Solanki” [email protected] wrote:

Hello,

My pandas Dataframe contains below characters.

Names

Kiljavan Lääketutkimus

Centre Hospitalier Régional Universitaire de Montpellier

Hospital Regional Universitario de Málaga

Akdeniz Üniversitesi Hastanesi

MVZ für Rheumatologie Dr. Martin Welcker

During rendering this dataframe to bokeh charts.

It throws error - "UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xc3 in position 19: unexpected end of data"

I tried

df[“names”] = df[“names”].apply(lambda x: x.decode(‘unicode_escape’).encode(‘ascii’, ‘replace’).strip())

but it is ignore UTF-8 Characters that i dont’ want. I need to keep data intact

Any help ?

Nitin

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

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/CAOUEs4UfBT1f1a7hA8oUk5eOf5-Tm%3D-9–mY2A0GCQVOgVgYrg%40mail.gmail.com.

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

I’m not using CSV.

I created by own pandas DataFrame without CSV.

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

···

On Tue, Sep 19, 2017 at 4:26 PM, Hiram Foster [email protected] wrote:

When loading your df, try pd.read_csv('file', **encoding** = "**ISO**-8859-1")
(Adjusting for your source and file name).

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/CAO0BaO1EaVRSNbVwoPkk%2B3f1NC%2BO9SnQ_Uki0RybFoP8KxX31Q%40mail.gmail.com.

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

On Sep 19, 2017 6:02 AM, “Nitin Solanki” [email protected] wrote:

Hello,

My pandas Dataframe contains below characters.

Names

Kiljavan Lääketutkimus

Centre Hospitalier Régional Universitaire de Montpellier

Hospital Regional Universitario de Málaga

Akdeniz Üniversitesi Hastanesi

MVZ für Rheumatologie Dr. Martin Welcker

During rendering this dataframe to bokeh charts.

It throws error - "UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xc3 in position 19: unexpected end of data"

I tried

df[“names”] = df[“names”].apply(lambda x: x.decode(‘unicode_escape’).encode(‘ascii’, ‘replace’).strip())

but it is ignore UTF-8 Characters that i dont’ want. I need to keep data intact

Any help ?

Nitin

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

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/CAOUEs4UfBT1f1a7hA8oUk5eOf5-Tm%3D-9–mY2A0GCQVOgVgYrg%40mail.gmail.com.

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

Did you try series.str.decode('ISO-8859-1')?

···

On Sep 19, 2017 7:02 AM, “Nitin Solanki” [email protected] wrote:

I’m not using CSV.

I created by own pandas DataFrame without CSV.

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

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/CAOUEs4VdNT1s%3Dteo_xv16-ZTzOs-Sdu%2Bp_zGaBh-UAT_vTMvOQ%40mail.gmail.com.

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

On Tue, Sep 19, 2017 at 4:26 PM, Hiram Foster [email protected] wrote:

When loading your df, try pd.read_csv('file', **encoding** = "**ISO**-8859-1")
(Adjusting for your source and file name).

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/CAO0BaO1EaVRSNbVwoPkk%2B3f1NC%2BO9SnQ_Uki0RybFoP8KxX31Q%40mail.gmail.com.

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

On Sep 19, 2017 6:02 AM, “Nitin Solanki” [email protected] wrote:

Hello,

My pandas Dataframe contains below characters.

Names

Kiljavan Lääketutkimus

Centre Hospitalier Régional Universitaire de Montpellier

Hospital Regional Universitario de Málaga

Akdeniz Üniversitesi Hastanesi

MVZ für Rheumatologie Dr. Martin Welcker

During rendering this dataframe to bokeh charts.

It throws error - "UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xc3 in position 19: unexpected end of data"

I tried

df[“names”] = df[“names”].apply(lambda x: x.decode(‘unicode_escape’).encode(‘ascii’, ‘replace’).strip())

but it is ignore UTF-8 Characters that i dont’ want. I need to keep data intact

Any help ?

Nitin

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

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/CAOUEs4UfBT1f1a7hA8oUk5eOf5-Tm%3D-9–mY2A0GCQVOgVgYrg%40mail.gmail.com.

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

Even though, I dump my Dataframe to CSV and read load dumped CSV using pd.read_csv('file', **encoding** = "**ISO**-8859-1"). It doesn’t work too.

Issue is in “components()” of bokeh. It is doing something strange.

Error:

Traceback (most recent call last):

File “modules/data_profiling_sql/layout/populate_in_html.py”, line 342, in populate_plots_data

script, plots = components(plot_data)

File “/usr/local/lib/python2.7/dist-packages/bokeh/embed.py”, line 233, in components

(docs_json, render_items) = _standalone_docs_json_and_render_items(models)

File “/usr/local/lib/python2.7/dist-packages/bokeh/embed.py”, line 747, in _standalone_docs_json_and_render_items

docs_json[k] = v.to_json()

File “/usr/local/lib/python2.7/dist-packages/bokeh/document.py”, line 734, in to_json

doc_json = self.to_json_string()

File “/usr/local/lib/python2.7/dist-packages/bokeh/document.py”, line 763, in to_json_string

return serialize_json(json, indent=indent)

File “/usr/local/lib/python2.7/dist-packages/bokeh/core/json_encoder.py”, line 226, in serialize_json

return json.dumps(obj, cls=BokehJSONEncoder, allow_nan=False, indent=indent, separators=separators, sort_keys=True, **kwargs)

File “/usr/lib/python2.7/json/init.py”, line 251, in dumps

sort_keys=sort_keys, **kw).encode(obj)

File “/usr/lib/python2.7/json/encoder.py”, line 209, in encode

chunks = list(chunks)

File “/usr/lib/python2.7/json/encoder.py”, line 434, in _iterencode

for chunk in _iterencode_dict(o, _current_indent_level):

File “/usr/lib/python2.7/json/encoder.py”, line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/encoder.py”, line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/encoder.py”, line 332, in _iterencode_list

for chunk in chunks:

File “/usr/lib/python2.7/json/encoder.py”, line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/encoder.py”, line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/encoder.py”, line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/encoder.py”, line 313, in _iterencode_list

yield buf + _encoder(value)

UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xc3 in position 19: unexpected end of data

Process finished with exit code 1

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

···

On Tue, Sep 19, 2017 at 4:32 PM, Nitin Solanki [email protected] wrote:

I’m not using CSV.

I created by own pandas DataFrame without CSV.

On Tue, Sep 19, 2017 at 4:26 PM, Hiram Foster [email protected] wrote:

When loading your df, try pd.read_csv('file', **encoding** = "**ISO**-8859-1")
(Adjusting for your source and file name).

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/CAO0BaO1EaVRSNbVwoPkk%2B3f1NC%2BO9SnQ_Uki0RybFoP8KxX31Q%40mail.gmail.com.

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

On Sep 19, 2017 6:02 AM, “Nitin Solanki” [email protected] wrote:

Hello,

My pandas Dataframe contains below characters.

Names

Kiljavan Lääketutkimus

Centre Hospitalier Régional Universitaire de Montpellier

Hospital Regional Universitario de Málaga

Akdeniz Üniversitesi Hastanesi

MVZ für Rheumatologie Dr. Martin Welcker

During rendering this dataframe to bokeh charts.

It throws error - "UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xc3 in position 19: unexpected end of data"

I tried

df[“names”] = df[“names”].apply(lambda x: x.decode(‘unicode_escape’).encode(‘ascii’, ‘replace’).strip())

but it is ignore UTF-8 Characters that i dont’ want. I need to keep data intact

Any help ?

Nitin

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

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/CAOUEs4UfBT1f1a7hA8oUk5eOf5-Tm%3D-9–mY2A0GCQVOgVgYrg%40mail.gmail.com.

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

No Luck :frowning:

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

···

On Tue, Sep 19, 2017 at 4:35 PM, Hiram Foster [email protected] wrote:

Did you try series.str.decode('ISO-8859-1')?

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/CAO0BaO0hZp-KUKAWWzO7KPgoqixv_oHe43D0KK28HHkUV9xJaA%40mail.gmail.com.

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

On Sep 19, 2017 7:02 AM, “Nitin Solanki” [email protected] wrote:

I’m not using CSV.

I created by own pandas DataFrame without CSV.

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

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/CAOUEs4VdNT1s%3Dteo_xv16-ZTzOs-Sdu%2Bp_zGaBh-UAT_vTMvOQ%40mail.gmail.com.

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

On Tue, Sep 19, 2017 at 4:26 PM, Hiram Foster [email protected] wrote:

When loading your df, try pd.read_csv('file', **encoding** = "**ISO**-8859-1")
(Adjusting for your source and file name).

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/CAO0BaO1EaVRSNbVwoPkk%2B3f1NC%2BO9SnQ_Uki0RybFoP8KxX31Q%40mail.gmail.com.

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

On Sep 19, 2017 6:02 AM, “Nitin Solanki” [email protected] wrote:

Hello,

My pandas Dataframe contains below characters.

Names

Kiljavan Lääketutkimus

Centre Hospitalier Régional Universitaire de Montpellier

Hospital Regional Universitario de Málaga

Akdeniz Üniversitesi Hastanesi

MVZ für Rheumatologie Dr. Martin Welcker

During rendering this dataframe to bokeh charts.

It throws error - "UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xc3 in position 19: unexpected end of data"

I tried

df[“names”] = df[“names”].apply(lambda x: x.decode(‘unicode_escape’).encode(‘ascii’, ‘replace’).strip())

but it is ignore UTF-8 Characters that i dont’ want. I need to keep data intact

Any help ?

Nitin

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

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/CAOUEs4UfBT1f1a7hA8oUk5eOf5-Tm%3D-9–mY2A0GCQVOgVgYrg%40mail.gmail.com.

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

As you can see in the traceback. bokeh-json-encoder is not able
to encode your data.

  ```
  import json
  from bokeh.core.json_encoder import BokehJSONEncoder
  data = [' ᶇ ᶈ ᶉ ᶊ ᶋ ᶌ ᶍ ᶎ ']
  json.dumps(data, cls=BokehJSONEncoder)
  ```

  try to reproduce with the above code. Replace the *data*
  with your dataframe.
···

On 2017-09-19 13:05, Nitin Solanki
wrote:

    Even though, I dump my Dataframe to CSV and read

load dumped CSV using pd.read_csv('file', **encoding** = "**ISO**-8859-1"). It
doesn’t work too.

      Issue is in "components()" of bokeh. It is doing something

strange.

Error:

Traceback (most recent call last):

        File

“modules/data_profiling_sql/layout/populate_in_html.py”,
line 342, in populate_plots_data

script, plots = components(plot_data)

        File

“/usr/local/lib/python2.7/dist-packages/bokeh/embed.py”,
line 233, in components

        (docs_json, render_items) =

_standalone_docs_json_and_render_items(models)

        File

“/usr/local/lib/python2.7/dist-packages/bokeh/embed.py”,
line 747, in _standalone_docs_json_and_render_items

docs_json[k] = v.to_json()

        File

“/usr/local/lib/python2.7/dist-packages/bokeh/document.py”,
line 734, in to_json

doc_json = self.to_json_string()

        File

“/usr/local/lib/python2.7/dist-packages/bokeh/document.py”,
line 763, in to_json_string

return serialize_json(json, indent=indent)

        File

“/usr/local/lib/python2.7/dist-packages/bokeh/core/json_encoder.py”,
line 226, in serialize_json

        return json.dumps(obj, cls=BokehJSONEncoder,

allow_nan=False, indent=indent, separators=separators,
sort_keys=True, **kwargs)

        File "/usr/lib/python2.7/json/__init__.py", line 251,

in dumps

sort_keys=sort_keys, **kw).encode(obj)

        File "/usr/lib/python2.7/json/encoder.py", line 209, in

encode

chunks = list(chunks)

        File "/usr/lib/python2.7/json/encoder.py", line 434, in

_iterencode

        for chunk in _iterencode_dict(o,

_current_indent_level):

        File "/usr/lib/python2.7/json/encoder.py", line 408, in

_iterencode_dict

for chunk in chunks:

        File "/usr/lib/python2.7/json/encoder.py", line 408, in

_iterencode_dict

for chunk in chunks:

        File "/usr/lib/python2.7/json/encoder.py", line 332, in

_iterencode_list

for chunk in chunks:

        File "/usr/lib/python2.7/json/encoder.py", line 408, in

_iterencode_dict

for chunk in chunks:

        File "/usr/lib/python2.7/json/encoder.py", line 408, in

_iterencode_dict

for chunk in chunks:

        File "/usr/lib/python2.7/json/encoder.py", line 408, in

_iterencode_dict

for chunk in chunks:

        File "/usr/lib/python2.7/json/encoder.py", line 313, in

_iterencode_list

yield buf + _encoder(value)

        UnicodeDecodeError: 'utf8' codec can't decode byte 0xc3

in position 19: unexpected end of data

Process finished with exit code 1

          On Tue, Sep 19, 2017 at 4:32 PM,

Nitin Solanki [email protected]
wrote:

I’m not using CSV.

I created by own pandas DataFrame without CSV.

                    On Tue, Sep 19, 2017 at

4:26 PM, Hiram Foster [email protected]
wrote:

When loading your df, try pd.read_csv('file', **encoding** = "**ISO**-8859-1")
(Adjusting
for your source and file name).

                              On

Sep 19, 2017 6:02 AM, “Nitin Solanki”
<[email protected] >
wrote:

Hello,

                                    My pandas Dataframe contains

below characters.

Names

                                                Kiljavan

Lääketutkimus

                                                Centre

Hospitalier
Régional
Universitaire de
Montpellier

                                                Hospital

Regional
Universitario de
Málaga

                                                Akdeniz

Üniversitesi
Hastanesi

                                                MVZ

für Rheumatologie
Dr. Martin Welcker

                                    During rendering this

dataframe to bokeh charts.

It throws error - ** “UnicodeDecodeError:
‘utf8’ codec can’t decode byte
0xc3 in position 19:
unexpected end of data”**

I tried

** df[“names”]
= df[“names”].apply(lambda x:
x.decode(‘unicode_escape’).enc ode(‘ascii’,
‘replace’).strip())**

                                    but it is ignore UTF-8

Characters that i dont’ want. *** I
need to keep data intact***

Any help ?

Nitin

                                This e-mail,

including any attached files, may
contain confidential and privileged
information for the sole use of the
intended recipient. Any review, use,
distribution, or disclosure by
others is strictly prohibited. If
you are not the intended recipient
(or authorized to receive
information for the intended
recipient), please contact the
sender by reply e-mail and delete
all copies of this message.

                                --

                                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/CAOUEs4UfBT1f1a7hA8oUk5eOf5-Tm%3D-9–mY2A0GCQVOgVgYrg%40mail.gmail.com.

                                For more options, visit [https://groups.google.com/a/continuum.io/d/optout](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/CAO0BaO1EaVRSNbVwoPkk%2B3f1NC%2BO9SnQ_Uki0RybFoP8KxX31Q%40mail.gmail.com](https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAO0BaO1EaVRSNbVwoPkk%2B3f1NC%2BO9SnQ_Uki0RybFoP8KxX31Q%40mail.gmail.com?utm_medium=email&utm_source=footer).

                          For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
      This e-mail,

including any attached files, may contain confidential and
privileged information for the sole use of the intended
recipient. Any review, use, distribution, or disclosure by
others is strictly prohibited. If you are not the intended
recipient (or authorized to receive information for the
intended recipient), please contact the sender by reply e-mail
and delete all copies of this message.

  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/CAOUEs4X4xbKP%2BGHPQLGtOuz3qVHQAZV3aR6WFvuMT%2BEnAqeW8Q%40mail.gmail.com](https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOUEs4X4xbKP%2BGHPQLGtOuz3qVHQAZV3aR6WFvuMT%2BEnAqeW8Q%40mail.gmail.com?utm_medium=email&utm_source=footer).

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

Replaced data with my DataFrame. It fails.

Not getting how to fix it ?

Traceback (most recent call last):

File “modules/data_profiling_sql/miscellanous/middleware.py”, line 53, in generate_plots_data

print json.dumps(data, cls=BokehJSONEncoder)

File “/usr/lib/python2.7/json/init.py”, line 251, in dumps

sort_keys=sort_keys, **kw).encode(obj)

File “/usr/lib/python2.7/json/encoder.py”, line 207, in encode

chunks = self.iterencode(o, _one_shot=True)

File “/usr/lib/python2.7/json/encoder.py”, line 270, in iterencode

return _iterencode(o, 0)

File “/usr/local/lib/python2.7/dist-packages/bokeh/core/json_encoder.py”, line 149, in default

return self.transform_python_types(obj)

File “/usr/local/lib/python2.7/dist-packages/bokeh/core/json_encoder.py”, line 116, in transform_python_types

return super(BokehJSONEncoder, self).default(obj)

File “/usr/lib/python2.7/json/encoder.py”, line 184, in default

raise TypeError(repr(o) + " is not JSON serializable")

TypeError: category bin count total

0 Akdeniz Üniversitesi Hastanesi 1-1 1 1.0

1 Akdeniz Üniversitesi Hastanesi 2-2 0 1.0

2 centimètre 1-1 1 1.0

3 centimètre 2-2 0 1.0

4 Centre Hospitalier Régional Universitaire d… 1-1 1 1.0

5 Centre Hospitalier Régional Universitaire d… 2-2 0 1.0

6 Désolé(e) 1-1 1 1.0

7 Désolé(e) 2-2 0 1.0

8 Hospital Regional Universitario de Málaga 1-1 1 1.0

9 Hospital Regional Universitario de Málaga 2-2 0 1.0

10 Kiljavan Lääketutkimus 1-1 1 1.0

11 Kiljavan Lääketutkimus 2-2 0 1.0

12 Magyar Honvédség Egészségügyi K… 1-1 1 1.0

13 Magyar Honvédség Egészségügyi K… 2-2 0 1.0

14 MVZ für Rheumatologie Dr. Martin Welcker 1-1 1 1.0

15 MVZ für Rheumatologie Dr. Martin Welcker 2-2 0 1.0

16 na 1-1 0 0.0

17 na 2-2 0 0.0

18 Nemocnica Košice-Šaca 1-1 1 1.0

19 Nemocnica Košice-Šaca 2-2 0 1.0

20 others 1-1 0 0.0

21 others 2-2 0 0.0

22 Private Practice - Dr. Klára Šírová 1-1 1 1.0

23 Private Practice - Dr. Klára Šírová 2-2 0 1.0

24 Sil 1-1 0 1.0

25 Sil 2-2 1 1.0

26 S’il 1-1 0 1.0

27 S’il 2-2 1 1.0

28 vous plaît 1-1 1 1.0

29 vous plaît 2-2 0 1.0 is not JSON serializable

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

···

On Tue, Sep 19, 2017 at 4:50 PM, Web Busino [email protected] wrote:

  As you can see in the traceback. bokeh-json-encoder is not able

to encode your data.

  ```
  import json
  from bokeh.core.json_encoder import BokehJSONEncoder
  data = [' ᶇ ᶈ ᶉ ᶊ ᶋ ᶌ ᶍ ᶎ ']
  json.dumps(data, cls=BokehJSONEncoder)
  ```

  try to reproduce with the above code. Replace the *data*
  with your dataframe.
  On 2017-09-19 13:05, Nitin Solanki

wrote:

    Even though, I dump my Dataframe to CSV and read

load dumped CSV using pd.read_csv('file', **encoding** = "**ISO**-8859-1"). It
doesn’t work too.

      Issue is in "components()" of bokeh. It is doing something

strange.

Error:

Traceback (most recent call last):

        File

“modules/data_profiling_sql/ layout/populate_in_html.py”,
line 342, in populate_plots_data

script, plots = components(plot_data)

        File

“/usr/local/lib/python2.7/ dist-packages/bokeh/embed.py”,
line 233, in components

        (docs_json, render_items) =

_standalone_docs_json_and_render_items(models)

        File

“/usr/local/lib/python2.7/ dist-packages/bokeh/embed.py”,
line 747, in _standalone_docs_json_and_render_items

docs_json[k] = v.to_json()

        File

“/usr/local/lib/python2.7/dist-packages/bokeh/document. py”,
line 734, in to_json

doc_json = self.to_json_string()

        File

“/usr/local/lib/python2.7/dist-packages/bokeh/document. py”,
line 763, in to_json_string

return serialize_json(json, indent=indent)

        File

“/usr/local/lib/python2.7/dist-packages/bokeh/core/json_ encoder.py”,
line 226, in serialize_json

        return json.dumps(obj, cls=BokehJSONEncoder,

allow_nan=False, indent=indent, separators=separators,
sort_keys=True, **kwargs)

File “/usr/lib/python2.7/json/__ init__.py”, line 251,
in dumps

sort_keys=sort_keys, **kw).encode(obj)

File “/usr/lib/python2.7/json/ encoder.py”, line 209, in
encode

chunks = list(chunks)

File “/usr/lib/python2.7/json/ encoder.py”, line 434, in
_iterencode

        for chunk in _iterencode_dict(o,

_current_indent_level):

File “/usr/lib/python2.7/json/ encoder.py”, line 408, in
_iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/ encoder.py”, line 408, in
_iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/ encoder.py”, line 332, in
_iterencode_list

for chunk in chunks:

File “/usr/lib/python2.7/json/ encoder.py”, line 408, in
_iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/ encoder.py”, line 408, in
_iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/ encoder.py”, line 408, in
_iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/ encoder.py”, line 313, in
_iterencode_list

yield buf + _encoder(value)

        UnicodeDecodeError: 'utf8' codec can't decode byte 0xc3

in position 19: unexpected end of data

Process finished with exit code 1

      This e-mail,

including any attached files, may contain confidential and
privileged information for the sole use of the intended
recipient. Any review, use, distribution, or disclosure by
others is strictly prohibited. If you are not the intended
recipient (or authorized to receive information for the
intended recipient), please contact the sender by reply e-mail
and delete all copies of this message.

  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/CAOUEs4X4xbKP%2BGHPQLGtOuz3qVHQAZV3aR6WFvuMT%2BEnAqeW8Q%40mail.gmail.com.

  For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
          On Tue, Sep 19, 2017 at 4:32 PM,

Nitin Solanki [email protected]
wrote:

I’m not using CSV.

I created by own pandas DataFrame without CSV.

                    On Tue, Sep 19, 2017 at

4:26 PM, Hiram Foster [email protected]
wrote:

When loading your df, try pd.read_csv('file', **encoding** = "**ISO**-8859-1")
(Adjusting
for your source and file name).

                          --

                          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/CAO0BaO1EaVRSNbVwoPkk%2B3f1NC%2BO9SnQ_Uki0RybFoP8KxX31Q%40mail.gmail.com](https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAO0BaO1EaVRSNbVwoPkk%2B3f1NC%2BO9SnQ_Uki0RybFoP8KxX31Q%40mail.gmail.com?utm_medium=email&utm_source=footer).

                          For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
                              On

Sep 19, 2017 6:02 AM, “Nitin Solanki”
<[email protected] >
wrote:

Hello,

                                    My pandas Dataframe contains

below characters.

Names

                                                Kiljavan

Lääketutkimus

                                                Centre

Hospitalier
Régional
Universitaire de
Montpellier

                                                Hospital

Regional
Universitario de
Málaga

                                                Akdeniz

Üniversitesi
Hastanesi

                                                MVZ

für Rheumatologie
Dr. Martin Welcker

                                    During rendering this

dataframe to bokeh charts.

It throws error - ** “UnicodeDecodeError:
‘utf8’ codec can’t decode byte
0xc3 in position 19:
unexpected end of data”**

I tried

** df[“names”]
= df[“names”].apply(lambda x:
x.decode(‘unicode_escape’).enc ode(‘ascii’,
‘replace’).strip())**

                                    but it is ignore UTF-8

Characters that i dont’ want. *** I
need to keep data intact***

Any help ?

Nitin

                                This e-mail,

including any attached files, may
contain confidential and privileged
information for the sole use of the
intended recipient. Any review, use,
distribution, or disclosure by
others is strictly prohibited. If
you are not the intended recipient
(or authorized to receive
information for the intended
recipient), please contact the
sender by reply e-mail and delete
all copies of this message.

                                --

                                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/CAOUEs4UfBT1f1a7hA8oUk5eOf5-Tm%3D-9–mY2A0GCQVOgVgYrg%40mail.gmail.com.

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

Sorry, it looks like the serialization of the data of
the datasource is failing.

  ```

 import json

  from bokeh.core.json_encoder import BokehJSONEncoder

      df = pandas.DataFrame(data=[dict(i=1,name='Akdeniz

Üniversitesi Hastanesi’)])

data_source = ColumnDataSource(data=df)

 json.dumps(data_source, cls=BokehJSONEncoder)

  ```
···

On 2017-09-19 13:23, Nitin Solanki
wrote:

Replaced data with my DataFrame. It fails.

Not getting how to fix it ?

Traceback (most recent call last):

      File

“modules/data_profiling_sql/miscellanous/middleware.py”, line
53, in generate_plots_data

print json.dumps(data, cls=BokehJSONEncoder)

      File "/usr/lib/python2.7/json/__init__.py", line 251, in

dumps

sort_keys=sort_keys, **kw).encode(obj)

      File "/usr/lib/python2.7/json/encoder.py", line 207, in

encode

chunks = self.iterencode(o, _one_shot=True)

      File "/usr/lib/python2.7/json/encoder.py", line 270, in

iterencode

return _iterencode(o, 0)

      File

“/usr/local/lib/python2.7/dist-packages/bokeh/core/json_encoder.py”,
line 149, in default

return self.transform_python_types(obj)

      File

“/usr/local/lib/python2.7/dist-packages/bokeh/core/json_encoder.py”,
line 116, in transform_python_types

return super(BokehJSONEncoder, self).default(obj)

      File "/usr/lib/python2.7/json/encoder.py", line 184, in

default

raise TypeError(repr(o) + " is not JSON serializable")

      TypeError:                                            

category bin count total

      0                   Akdeniz Üniversitesi Hastanesi  1-1
1    1.0
      1                   Akdeniz Üniversitesi Hastanesi  2-2
0    1.0
      2                                          centimètre  1-1
1    1.0
      3                                          centimètre  2-2
0    1.0
      4   Centre Hospitalier Régional Universitaire d...  1-1
1    1.0
      5   Centre Hospitalier Régional Universitaire d...  2-2
0    1.0
      6                                           Désolé(e)  1-1
1    1.0
      7                                           Désolé(e)  2-2
0    1.0
      8        Hospital Regional Universitario de Málaga  1-1
1    1.0
      9        Hospital Regional Universitario de Málaga  2-2
0    1.0
      10                       Kiljavan Lääketutkimus  1-1
1    1.0
      11                       Kiljavan Lääketutkimus  2-2
0    1.0
      12  Magyar Honvédség Egészségügyi K...  1-1
1    1.0
      13  Magyar Honvédség Egészségügyi K...  2-2
0    1.0
      14        MVZ für Rheumatologie Dr. Martin Welcker  1-1
1    1.0
      15        MVZ für Rheumatologie Dr. Martin Welcker  2-2
0    1.0
      16                                                 na  1-1
0    0.0
      17                                                 na  2-2
0    0.0
      18                        Nemocnica Košice-Šaca  1-1
1    1.0
      19                        Nemocnica Košice-Šaca  2-2
0    1.0
      20                                             others  1-1
0    0.0
      21                                             others  2-2
0    0.0
      22    Private Practice - Dr. Klára Šírová  1-1
1    1.0
      23    Private Practice - Dr. Klára Šírová  2-2
0    1.0
      24                                                Sil  1-1
0    1.0
      25                                                Sil  2-2
1    1.0
      26                                              S'il   1-1
0    1.0
      27                                              S'il   2-2
1    1.0
      28                                         vous plaît  1-1
1    1.0
      29                                         vous plaît  2-2
0    1.0 is not JSON serializable
      On Tue, Sep 19, 2017 at 4:50 PM, Web

Busino [email protected]
wrote:

              As you can see in the traceback. bokeh-json-encoder

is not able to encode your data.

              ```
              import json
              from bokeh.core.json_encoder import BokehJSONEncoder
              data = [' ᶇ ᶈ ᶉ ᶊ ᶋ ᶌ ᶍ ᶎ ']
              json.dumps(data, cls=BokehJSONEncoder)
              ```

              try to reproduce with the above code. Replace the *data*
              with your dataframe.
              On

2017-09-19 13:05, Nitin Solanki wrote:

                  Even though, I dump my Dataframe to

CSV and read load dumped CSV using pd.read_csv('file', **encoding** = "**ISO**-8859-1"). It
doesn’t work too.

                    Issue is in "components()" of bokeh. It is

doing something strange.

Error:

Traceback (most recent call last):

File “modules/data_profiling_sql/ layout/populate_in_html.py”,
line 342, in populate_plots_data

script, plots = components(plot_data)

File “/usr/local/lib/python2.7/ dist-packages/bokeh/embed.py”,
line 233, in components

                      (docs_json, render_items) =

_standalone_docs_json_and_render_items(models)

File “/usr/local/lib/python2.7/ dist-packages/bokeh/embed.py”,
line 747, in _standalone_docs_json_and_render_items

docs_json[k] = v.to_json()

File “/usr/local/lib/python2.7/dist-packages/bokeh/document. py”,
line 734, in to_json

doc_json = self.to_json_string()

File “/usr/local/lib/python2.7/dist-packages/bokeh/document. py”,
line 763, in to_json_string

                      return serialize_json(json,

indent=indent)

File “/usr/local/lib/python2.7/dist-packages/bokeh/core/json_ encoder.py”,
line 226, in serialize_json

                      return json.dumps(obj,

cls=BokehJSONEncoder, allow_nan=False,
indent=indent, separators=separators,
sort_keys=True, **kwargs)

File “/usr/lib/python2.7/json/__ init__.py”,
line 251, in dumps

sort_keys=sort_keys, **kw).encode(obj)

File “/usr/lib/python2.7/json/ encoder.py”,
line 209, in encode

chunks = list(chunks)

File “/usr/lib/python2.7/json/ encoder.py”,
line 434, in _iterencode

                      for chunk in _iterencode_dict(o,

_current_indent_level):

File “/usr/lib/python2.7/json/ encoder.py”,
line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/ encoder.py”,
line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/ encoder.py”,
line 332, in _iterencode_list

for chunk in chunks:

File “/usr/lib/python2.7/json/ encoder.py”,
line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/ encoder.py”,
line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/ encoder.py”,
line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/ encoder.py”,
line 313, in _iterencode_list

yield buf + _encoder(value)

                      UnicodeDecodeError: 'utf8' codec can't

decode byte 0xc3 in position 19: unexpected
end of data

Process finished with exit code 1

                        On Tue, Sep 19, 2017

at 4:32 PM, Nitin Solanki [email protected]
wrote:

I’m not using CSV.

                              I created by own pandas DataFrame

without CSV.

                                  On Tue, Sep

19, 2017 at 4:26 PM, Hiram Foster
[email protected]
wrote:

                                      When loading

your df, try pd.read_csv('file', **encoding** = "**ISO**-8859-1")
(Adjusting
for your source and file
name).

                                            On

Sep 19, 2017 6:02 AM,
“Nitin Solanki” <[email protected] >
wrote:

Hello,

                                                  My pandas

Dataframe contains
below characters.

Names

Kiljavan
Lääketutkimus

                                                      Centre

Hospitalier
Régional
Universitaire
de Montpellier

                                                      Hospital

Regional
Universitario
de Málaga

Akdeniz
Üniversitesi Hastanesi

                                                      MVZ

für
Rheumatologie
Dr. Martin
Welcker

                                                  During

rendering this
dataframe to bokeh
charts.

                                                  It throws error
  • ** “UnicodeDecodeError:
    ‘utf8’ codec
    can’t decode
    byte 0xc3 in
    position 19:
    unexpected end
    of data”**

I tried

** df[“names”]

df[“names”].apply(lambda
x:
x.decode(‘unicode_escape’).encode(‘ascii’,
‘replace’).strip())**

                                                  but it is

ignore UTF-8
Characters that i
dont’ want. *** I
need to keep
data intact***

Any help ?

Nitin

                                              This

e-mail, including any
attached files, may
contain confidential
and privileged
information for the
sole use of the
intended recipient.
Any review, use,
distribution, or
disclosure by others
is strictly
prohibited. If you are
not the intended
recipient (or
authorized to receive
information for the
intended recipient),
please contact the
sender by reply e-mail
and delete all copies
of this message.

                                              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/CAOUEs4UfBT1f1a7hA8oUk5eOf5-Tm%3D-9–mY2A0GCQVOgVgYrg%40mail.gmail.com.

                                              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/CAO0BaO1EaVRSNbVwoPkk%2B3f1NC%2BO9SnQ_Uki0RybFoP8KxX31Q%40mail.gmail.com.

                                        For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
                    This

e-mail, including any attached files, may
contain confidential and privileged information
for the sole use of the intended recipient. Any
review, use, distribution, or disclosure by
others is strictly prohibited. If you are not
the intended recipient (or authorized to receive
information for the intended recipient), please
contact the sender by reply e-mail and delete
all copies of this message.

                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/CAOUEs4X4xbKP%2BGHPQLGtOuz3qVHQAZV3aR6WFvuMT%2BEnAqeW8Q%40mail.gmail.com.

              For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
      This e-mail,

including any attached files, may contain confidential and
privileged information for the sole use of the intended
recipient. Any review, use, distribution, or disclosure by
others is strictly prohibited. If you are not the intended
recipient (or authorized to receive information for the
intended recipient), please contact the sender by reply e-mail
and delete all copies of this message.

  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/CAOUEs4Wzo5GWNhhQJT2t7aH-_yhYMjVXz%2BRv7J1umy2MgmCQ3Q%40mail.gmail.com](https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAOUEs4Wzo5GWNhhQJT2t7aH-_yhYMjVXz%2BRv7J1umy2MgmCQ3Q%40mail.gmail.com?utm_medium=email&utm_source=footer).

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

But your code is working. It is serialising properly. Could you please test the below code ?

import json
import pandas as pd
from bokeh.plotting import ColumnDataSource

from bokeh.core.json_encoder import BokehJSONEncoder
df = pandas.DataFrame(data=[dict(i=1,name='Akdeniz Üniversitesi Hastanesi')])
data_source = ColumnDataSource(data=df)
json.dumps(data_source, cls=BokehJSONEncoder)

Nitin

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

···

On Tue, Sep 19, 2017 at 5:05 PM, Web Busino [email protected] wrote:

  Sorry, it looks like the serialization of the data of

the datasource is failing.

  ```

 import json

  from bokeh.core.json_encoder import BokehJSONEncoder

df = pandas.DataFrame(data=[dict(i=      1,name='Akdeniz

Üniversitesi Hastanesi’)])

data_source = ColumnDataSource(data=df)

 json.dumps(data_source, cls=BokehJSONEncoder)

  ```





  On 2017-09-19 13:23, Nitin Solanki

wrote:

Replaced data with my DataFrame. It fails.

Not getting how to fix it ?

Traceback (most recent call last):

      File

“modules/data_profiling_sql/ miscellanous/middleware.py”, line
53, in generate_plots_data

print json.dumps(data, cls=BokehJSONEncoder)

File “/usr/lib/python2.7/json/__ init__.py”, line 251, in
dumps

sort_keys=sort_keys, **kw).encode(obj)

File “/usr/lib/python2.7/json/ encoder.py”, line 207, in
encode

chunks = self.iterencode(o, _one_shot=True)

File “/usr/lib/python2.7/json/ encoder.py”, line 270, in
iterencode

return _iterencode(o, 0)

      File

“/usr/local/lib/python2.7/dist-packages/bokeh/core/json_ encoder.py”,
line 149, in default

return self.transform_python_types(obj)

      File

“/usr/local/lib/python2.7/dist-packages/bokeh/core/json_ encoder.py”,
line 116, in transform_python_types

return super(BokehJSONEncoder, self).default(obj)

File “/usr/lib/python2.7/json/ encoder.py”, line 184, in
default

raise TypeError(repr(o) + " is not JSON serializable")

      TypeError:                                            

category bin count total

      0                   Akdeniz Üniversitesi Hastanesi  1-1
1    1.0
      1                   Akdeniz Üniversitesi Hastanesi  2-2
0    1.0
      2                                          centimètre  1-1
1    1.0
      3                                          centimètre  2-2
0    1.0
      4   Centre Hospitalier Régional Universitaire d...  1-1
1    1.0
      5   Centre Hospitalier Régional Universitaire d...  2-2
0    1.0
      6                                           Désolé(e)  1-1
1    1.0
      7                                           Désolé(e)  2-2
0    1.0
      8        Hospital Regional Universitario de Málaga  1-1
1    1.0
      9        Hospital Regional Universitario de Málaga  2-2
0    1.0
      10                       Kiljavan Lääketutkimus  1-1
1    1.0
      11                       Kiljavan Lääketutkimus  2-2
0    1.0
      12  Magyar Honvédség Egészségügyi K...  1-1
1    1.0
      13  Magyar Honvédség Egészségügyi K...  2-2
0    1.0
      14        MVZ für Rheumatologie Dr. Martin Welcker  1-1
1    1.0
      15        MVZ für Rheumatologie Dr. Martin Welcker  2-2
0    1.0
      16                                                 na  1-1
0    0.0
      17                                                 na  2-2
0    0.0
      18                        Nemocnica Košice-Šaca  1-1
1    1.0
      19                        Nemocnica Košice-Šaca  2-2
0    1.0
      20                                             others  1-1
0    0.0
      21                                             others  2-2
0    0.0
      22    Private Practice - Dr. Klára Šírová  1-1
1    1.0
      23    Private Practice - Dr. Klára Šírová  2-2
0    1.0
      24                                                Sil  1-1
0    1.0
      25                                                Sil  2-2
1    1.0
      26                                              S'il   1-1
0    1.0
      27                                              S'il   2-2
1    1.0
      28                                         vous plaît  1-1
1    1.0
      29                                         vous plaît  2-2
0    1.0 is not JSON serializable
      This e-mail,

including any attached files, may contain confidential and
privileged information for the sole use of the intended
recipient. Any review, use, distribution, or disclosure by
others is strictly prohibited. If you are not the intended
recipient (or authorized to receive information for the
intended recipient), please contact the sender by reply e-mail
and delete all copies of this message.

  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/CAOUEs4Wzo5GWNhhQJT2t7aH-_yhYMjVXz%2BRv7J1umy2MgmCQ3Q%40mail.gmail.com.

  For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
      On Tue, Sep 19, 2017 at 4:50 PM, Web

Busino [email protected]
wrote:

              As you can see in the traceback. bokeh-json-encoder

is not able to encode your data.

              ```
              import json
              from bokeh.core.json_encoder import BokehJSONEncoder
              data = [' ᶇ ᶈ ᶉ ᶊ ᶋ ᶌ ᶍ ᶎ ']
              json.dumps(data, cls=BokehJSONEncoder)
              ```

              try to reproduce with the above code. Replace the *data*
              with your dataframe.
              On

2017-09-19 13:05, Nitin Solanki wrote:

                  Even though, I dump my Dataframe to

CSV and read load dumped CSV using pd.read_csv('file', **encoding** = "**ISO**-8859-1"). It
doesn’t work too.

                    Issue is in "components()" of bokeh. It is

doing something strange.

Error:

Traceback (most recent call last):

File “modules/data_profiling_sql/la yout/populate_in_html.py”,
line 342, in populate_plots_data

script, plots = components(plot_data)

File “/usr/local/lib/python2.7/dist -packages/bokeh/embed.py”,
line 233, in components

                      (docs_json, render_items) =

_standalone_docs_json_and_render_items(models)

File “/usr/local/lib/python2.7/dist -packages/bokeh/embed.py”,
line 747, in _standalone_docs_json_and_render_items

docs_json[k] = v.to_json()

File “/usr/local/lib/python2.7/dist -packages/bokeh/document.py”,
line 734, in to_json

doc_json = self.to_json_string()

File “/usr/local/lib/python2.7/dist -packages/bokeh/document.py”,
line 763, in to_json_string

                      return serialize_json(json,

indent=indent)

File “/usr/local/lib/python2.7/dist-packages/bokeh/core/json_enco der.py”,
line 226, in serialize_json

                      return json.dumps(obj,

cls=BokehJSONEncoder, allow_nan=False,
indent=indent, separators=separators,
sort_keys=True, **kwargs)

File “/usr/lib/python2.7/json/ini t.py”,
line 251, in dumps

sort_keys=sort_keys, **kw).encode(obj)

File “/usr/lib/python2.7/json/encod er.py”,
line 209, in encode

chunks = list(chunks)

File “/usr/lib/python2.7/json/encod er.py”,
line 434, in _iterencode

                      for chunk in _iterencode_dict(o,

_current_indent_level):

File “/usr/lib/python2.7/json/encod er.py”,
line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/encod er.py”,
line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/encod er.py”,
line 332, in _iterencode_list

for chunk in chunks:

File “/usr/lib/python2.7/json/encod er.py”,
line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/encod er.py”,
line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/encod er.py”,
line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/encod er.py”,
line 313, in _iterencode_list

yield buf + _encoder(value)

                      UnicodeDecodeError: 'utf8' codec can't

decode byte 0xc3 in position 19: unexpected
end of data

Process finished with exit code 1

                    This

e-mail, including any attached files, may
contain confidential and privileged information
for the sole use of the intended recipient. Any
review, use, distribution, or disclosure by
others is strictly prohibited. If you are not
the intended recipient (or authorized to receive
information for the intended recipient), please
contact the sender by reply e-mail and delete
all copies of this message.

                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/CAOUEs4X4xbKP%2BGHPQLGtOuz3qVHQAZV3aR6WFvuMT%2BEnAqeW8Q%40mail.gmail.com.

              For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
                        On Tue, Sep 19, 2017

at 4:32 PM, Nitin Solanki [email protected]
wrote:

I’m not using CSV.

                              I created by own pandas DataFrame

without CSV.

                                  On Tue, Sep

19, 2017 at 4:26 PM, Hiram Foster
[email protected]
wrote:

                                      When loading

your df, try pd.read_csv('file', **encoding** = "**ISO**-8859-1")
(Adjusting
for your source and file
name).

                                        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/CAO0BaO1EaVRSNbVwoPkk%2B3f1NC%2BO9SnQ_Uki0RybFoP8KxX31Q%40mail.gmail.com.

                                        For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
                                            On

Sep 19, 2017 6:02 AM,
“Nitin Solanki” <[email protected] >
wrote:

Hello,

                                                  My pandas

Dataframe contains
below characters.

Names

Kiljavan
Lääketutkimus

                                                      Centre

Hospitalier
Régional
Universitaire
de Montpellier

                                                      Hospital

Regional
Universitario
de Málaga

Akdeniz
Üniversitesi Hastanesi

                                                      MVZ

für
Rheumatologie
Dr. Martin
Welcker

                                                  During

rendering this
dataframe to bokeh
charts.

                                                  It throws error
  • ** “UnicodeDecodeError:
    ‘utf8’ codec
    can’t decode
    byte 0xc3 in
    position 19:
    unexpected end
    of data”**

I tried

** df[“names”]

df[“names”].apply(lambda
x:
x.decode(‘unicode_escape’).encode(‘ascii’,
‘replace’).strip())**

                                                  but it is

ignore UTF-8
Characters that i
dont’ want. *** I
need to keep
data intact***

Any help ?

Nitin

                                              This

e-mail, including any
attached files, may
contain confidential
and privileged
information for the
sole use of the
intended recipient.
Any review, use,
distribution, or
disclosure by others
is strictly
prohibited. If you are
not the intended
recipient (or
authorized to receive
information for the
intended recipient),
please contact the
sender by reply e-mail
and delete all copies
of this message.

                                              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/CAOUEs4UfBT1f1a7hA8oUk5eOf5-Tm%3D-9–mY2A0GCQVOgVgYrg%40mail.gmail.com.

                                              For more options,

visit https://groups.google.com/a/continuum.io/d/optout.

But your code is working. It is serialising properly. Could you please test the below code ?

import json
import pandas as pd
from bokeh.plotting import ColumnDataSource

<img class="gmail-ajT" src="https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif" style="opacity: 0.3;">

from bokeh.core.json_encoder import BokehJSONEncoder
df = pandas.DataFrame(data=[dict(i=1,name='Akdeniz Üniversitesi Hastanesi')])
data_source = ColumnDataSource(data=df)
json.dumps(data_source, cls=BokehJSONEncoder)

Nitin

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

···

On Tue, Sep 19, 2017 at 5:10 PM, Nitin Solanki [email protected] wrote:

But your code is working. It is serialising properly. Could you please test the below code ?

import json
import pandas as pd
from bokeh.plotting import ColumnDataSource

from bokeh.core.json_encoder import BokehJSONEncoder
df = pandas.DataFrame(data=[dict(i=1,name=‘Akdeniz Üniversitesi Hastanesi’)])
data_source = ColumnDataSource(data=df)
json.dumps(data_source, cls=BokehJSONEncoder)

Nitin

On Tue, Sep 19, 2017 at 5:05 PM, Web Busino [email protected] wrote:

  Sorry, it looks like the serialization of the data of

the datasource is failing.

  ```

 import json

  from bokeh.core.json_encoder import BokehJSONEncoder

df = pandas.DataFrame(data=[dict(i=      1,name='Akdeniz

Üniversitesi Hastanesi’)])

data_source = ColumnDataSource(data=df)

 json.dumps(data_source, cls=BokehJSONEncoder)

  ```





  On 2017-09-19 13:23, Nitin Solanki

wrote:

Replaced data with my DataFrame. It fails.

Not getting how to fix it ?

Traceback (most recent call last):

      File

“modules/data_profiling_sql/mi scellanous/middleware.py”, line
53, in generate_plots_data

print json.dumps(data, cls=BokehJSONEncoder)

File “/usr/lib/python2.7/json/ini t.py”, line 251, in
dumps

sort_keys=sort_keys, **kw).encode(obj)

File “/usr/lib/python2.7/json/encod er.py”, line 207, in
encode

chunks = self.iterencode(o, _one_shot=True)

File “/usr/lib/python2.7/json/encod er.py”, line 270, in
iterencode

return _iterencode(o, 0)

      File

“/usr/local/lib/python2.7/dist-packages/bokeh/core/json_enco der.py”,
line 149, in default

return self.transform_python_types(obj)

      File

“/usr/local/lib/python2.7/dist-packages/bokeh/core/json_enco der.py”,
line 116, in transform_python_types

return super(BokehJSONEncoder, self).default(obj)

File “/usr/lib/python2.7/json/encod er.py”, line 184, in
default

raise TypeError(repr(o) + " is not JSON serializable")

      TypeError:                                            

category bin count total

      0                   Akdeniz Üniversitesi Hastanesi  1-1
1    1.0
      1                   Akdeniz Üniversitesi Hastanesi  2-2
0    1.0
      2                                          centimètre  1-1
1    1.0
      3                                          centimètre  2-2
0    1.0
      4   Centre Hospitalier Régional Universitaire d...  1-1
1    1.0
      5   Centre Hospitalier Régional Universitaire d...  2-2
0    1.0
      6                                           Désolé(e)  1-1
1    1.0
      7                                           Désolé(e)  2-2
0    1.0
      8        Hospital Regional Universitario de Málaga  1-1
1    1.0
      9        Hospital Regional Universitario de Málaga  2-2
0    1.0
      10                       Kiljavan Lääketutkimus  1-1
1    1.0
      11                       Kiljavan Lääketutkimus  2-2
0    1.0
      12  Magyar Honvédség Egészségügyi K...  1-1
1    1.0
      13  Magyar Honvédség Egészségügyi K...  2-2
0    1.0
      14        MVZ für Rheumatologie Dr. Martin Welcker  1-1
1    1.0
      15        MVZ für Rheumatologie Dr. Martin Welcker  2-2
0    1.0
      16                                                 na  1-1
0    0.0
      17                                                 na  2-2
0    0.0
      18                        Nemocnica Košice-Šaca  1-1
1    1.0
      19                        Nemocnica Košice-Šaca  2-2
0    1.0
      20                                             others  1-1
0    0.0
      21                                             others  2-2
0    0.0
      22    Private Practice - Dr. Klára Šírová  1-1
1    1.0
      23    Private Practice - Dr. Klára Šírová  2-2
0    1.0
      24                                                Sil  1-1
0    1.0
      25                                                Sil  2-2
1    1.0
      26                                              S'il   1-1
0    1.0
      27                                              S'il   2-2
1    1.0
      28                                         vous plaît  1-1
1    1.0
      29                                         vous plaît  2-2
0    1.0 is not JSON serializable
      This e-mail,

including any attached files, may contain confidential and
privileged information for the sole use of the intended
recipient. Any review, use, distribution, or disclosure by
others is strictly prohibited. If you are not the intended
recipient (or authorized to receive information for the
intended recipient), please contact the sender by reply e-mail
and delete all copies of this message.

  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/CAOUEs4Wzo5GWNhhQJT2t7aH-_yhYMjVXz%2BRv7J1umy2MgmCQ3Q%40mail.gmail.com.

  For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
      On Tue, Sep 19, 2017 at 4:50 PM, Web

Busino [email protected]
wrote:

              As you can see in the traceback. bokeh-json-encoder

is not able to encode your data.

              ```
              import json
              from bokeh.core.json_encoder import BokehJSONEncoder
              data = [' ᶇ ᶈ ᶉ ᶊ ᶋ ᶌ ᶍ ᶎ ']
              json.dumps(data, cls=BokehJSONEncoder)
              ```

              try to reproduce with the above code. Replace the *data*
              with your dataframe.
              On

2017-09-19 13:05, Nitin Solanki wrote:

                  Even though, I dump my Dataframe to

CSV and read load dumped CSV using pd.read_csv('file', **encoding** = "**ISO**-8859-1"). It
doesn’t work too.

                    Issue is in "components()" of bokeh. It is

doing something strange.

Error:

Traceback (most recent call last):

File “modules/data_profiling_sql/la yout/populate_in_html.py”,
line 342, in populate_plots_data

script, plots = components(plot_data)

File “/usr/local/lib/python2.7/dist -packages/bokeh/embed.py”,
line 233, in components

                      (docs_json, render_items) =

_standalone_docs_json_and_render_items(models)

File “/usr/local/lib/python2.7/dist -packages/bokeh/embed.py”,
line 747, in _standalone_docs_json_and_render_items

docs_json[k] = v.to_json()

File “/usr/local/lib/python2.7/dist -packages/bokeh/document.py”,
line 734, in to_json

doc_json = self.to_json_string()

File “/usr/local/lib/python2.7/dist -packages/bokeh/document.py”,
line 763, in to_json_string

                      return serialize_json(json,

indent=indent)

File “/usr/local/lib/python2.7/dist-packages/bokeh/core/json_enco der.py”,
line 226, in serialize_json

                      return json.dumps(obj,

cls=BokehJSONEncoder, allow_nan=False,
indent=indent, separators=separators,
sort_keys=True, **kwargs)

File “/usr/lib/python2.7/json/ini t.py”,
line 251, in dumps

sort_keys=sort_keys, **kw).encode(obj)

File “/usr/lib/python2.7/json/encod er.py”,
line 209, in encode

chunks = list(chunks)

File “/usr/lib/python2.7/json/encod er.py”,
line 434, in _iterencode

                      for chunk in _iterencode_dict(o,

_current_indent_level):

File “/usr/lib/python2.7/json/encod er.py”,
line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/encod er.py”,
line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/encod er.py”,
line 332, in _iterencode_list

for chunk in chunks:

File “/usr/lib/python2.7/json/encod er.py”,
line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/encod er.py”,
line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/encod er.py”,
line 408, in _iterencode_dict

for chunk in chunks:

File “/usr/lib/python2.7/json/encod er.py”,
line 313, in _iterencode_list

yield buf + _encoder(value)

                      UnicodeDecodeError: 'utf8' codec can't

decode byte 0xc3 in position 19: unexpected
end of data

Process finished with exit code 1

                    This

e-mail, including any attached files, may
contain confidential and privileged information
for the sole use of the intended recipient. Any
review, use, distribution, or disclosure by
others is strictly prohibited. If you are not
the intended recipient (or authorized to receive
information for the intended recipient), please
contact the sender by reply e-mail and delete
all copies of this message.

                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/CAOUEs4X4xbKP%2BGHPQLGtOuz3qVHQAZV3aR6WFvuMT%2BEnAqeW8Q%40mail.gmail.com.

              For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
                        On Tue, Sep 19, 2017

at 4:32 PM, Nitin Solanki [email protected]
wrote:

I’m not using CSV.

                              I created by own pandas DataFrame

without CSV.

                                  On Tue, Sep

19, 2017 at 4:26 PM, Hiram Foster
[email protected]
wrote:

                                      When loading

your df, try pd.read_csv('file', **encoding** = "**ISO**-8859-1")
(Adjusting
for your source and file
name).

                                        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/CAO0BaO1EaVRSNbVwoPkk%2B3f1NC%2BO9SnQ_Uki0RybFoP8KxX31Q%40mail.gmail.com.

                                        For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
                                            On

Sep 19, 2017 6:02 AM,
“Nitin Solanki” <[email protected] >
wrote:

Hello,

                                                  My pandas

Dataframe contains
below characters.

Names

Kiljavan
Lääketutkimus

                                                      Centre

Hospitalier
Régional
Universitaire
de Montpellier

                                                      Hospital

Regional
Universitario
de Málaga

Akdeniz
Üniversitesi Hastanesi

                                                      MVZ

für
Rheumatologie
Dr. Martin
Welcker

                                                  During

rendering this
dataframe to bokeh
charts.

                                                  It throws error
  • ** “UnicodeDecodeError:
    ‘utf8’ codec
    can’t decode
    byte 0xc3 in
    position 19:
    unexpected end
    of data”**

I tried

** df[“names”]

df[“names”].apply(lambda
x:
x.decode(‘unicode_escape’).encode(‘ascii’,
‘replace’).strip())**

                                                  but it is

ignore UTF-8
Characters that i
dont’ want. *** I
need to keep
data intact***

Any help ?

Nitin

                                              This

e-mail, including any
attached files, may
contain confidential
and privileged
information for the
sole use of the
intended recipient.
Any review, use,
distribution, or
disclosure by others
is strictly
prohibited. If you are
not the intended
recipient (or
authorized to receive
information for the
intended recipient),
please contact the
sender by reply e-mail
and delete all copies
of this message.

                                              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/CAOUEs4UfBT1f1a7hA8oUk5eOf5-Tm%3D-9–mY2A0GCQVOgVgYrg%40mail.gmail.com.

                                              For more options,

visit https://groups.google.com/a/continuum.io/d/optout.

Yes, it does. But I’m not using py27.

But it was meant to help you solve your issue!!!

···

On 2017-09-19 13:40, Nitin Solanki
wrote:

        But your code is working. It

is serialising properly. Could you please test the below
code ?


          import json
import pandas as pd


                from
bokeh.plotting import ColumnDataSource
            from

bokeh.core.json_encoder import BokehJSONEncoder

                      df =

pandas.DataFrame(data=[dict(i= 1,name=‘Akdeniz
Üniversitesi Hastanesi’)])

        data_source = ColumnDataSource(data=df)

                      json.dumps(data_source,

cls=BokehJSONEncoder)

          ```

Nitin

      On Tue, Sep 19, 2017 at 5:05 PM, Web

Busino [email protected]
wrote:

            Sorry, it

looks like the serialization of the data of the
datasource is failing.

            ```

             import json

              from bokeh.core.json_encoder import BokehJSONEncoder

          df = pandas.DataFrame(data=[dict(i=                1,name='Akdeniz

Üniversitesi Hastanesi’)])

          data_source = ColumnDataSource(data=df)

           json.dumps(data_source, cls=BokehJSONEncoder)

            ```





                On

2017-09-19 13:23, Nitin Solanki wrote:

Replaced data with my DataFrame. It fails.

Not getting how to fix it ?

Traceback (most recent call last):

File “modules/data_profiling_sql/ miscellanous/middleware.py”,
line 53, in generate_plots_data

                    print json.dumps(data,

cls=BokehJSONEncoder)

File “/usr/lib/python2.7/json/__ init__.py”,
line 251, in dumps

sort_keys=sort_keys, **kw).encode(obj)

File “/usr/lib/python2.7/json/ encoder.py”,
line 207, in encode

                    chunks = self.iterencode(o,

_one_shot=True)

File “/usr/lib/python2.7/json/ encoder.py”,
line 270, in iterencode

return _iterencode(o, 0)

File “/usr/local/lib/python2.7/dist-packages/bokeh/core/json_ encoder.py”,
line 149, in default

return self.transform_python_types(obj)

File “/usr/local/lib/python2.7/dist-packages/bokeh/core/json_ encoder.py”,
line 116, in transform_python_types

                    return super(BokehJSONEncoder,

self).default(obj)

File “/usr/lib/python2.7/json/ encoder.py”,
line 184, in default

                    raise TypeError(repr(o) + " is not JSON

serializable")

                    TypeError:                                  
       category  bin count  total
                    0                   Akdeniz Üniversitesi

Hastanesi 1-1 1 1.0

                    1                   Akdeniz Üniversitesi

Hastanesi 2-2 0 1.0

                    2                                        

centimètre 1-1 1 1.0

                    3                                        

centimètre 2-2 0 1.0

                    4   Centre Hospitalier Régional

Universitaire d… 1-1 1 1.0

                    5   Centre Hospitalier Régional

Universitaire d… 2-2 0 1.0

                    6                                          

Désolé(e) 1-1 1 1.0

                    7                                          

Désolé(e) 2-2 0 1.0

                    8        Hospital Regional Universitario de

Málaga 1-1 1 1.0

                    9        Hospital Regional Universitario de

Málaga 2-2 0 1.0

                    10                       Kiljavan

Lääketutkimus 1-1 1 1.0

                    11                       Kiljavan

Lääketutkimus 2-2 0 1.0

                    12  Magyar Honvédség

Egészségügyi K… 1-1 1 1.0

                    13  Magyar Honvédség

Egészségügyi K… 2-2 0 1.0

                    14        MVZ für Rheumatologie Dr. Martin

Welcker 1-1 1 1.0

                    15        MVZ für Rheumatologie Dr. Martin

Welcker 2-2 0 1.0

                    16                                          
  na  1-1     0    0.0
                    17                                          
  na  2-2     0    0.0
                    18                        Nemocnica

Košice-Šaca 1-1 1 1.0

                    19                        Nemocnica

Košice-Šaca 2-2 0 1.0

                    20                                          

others 1-1 0 0.0

                    21                                          

others 2-2 0 0.0

                    22    Private Practice - Dr. Klára Ã…Â

írová 1-1 1 1.0

                    23    Private Practice - Dr. Klára Ã…Â

írová 2-2 0 1.0

                    24                                          
 Sil  1-1     0    1.0
                    25                                          
 Sil  2-2     1    1.0
                    26                                          

S’il 1-1 0 1.0

                    27                                          

S’il 2-2 1 1.0

                    28                                        

vous plaît 1-1 1 1.0

                    29                                        

vous plaît 2-2 0 1.0 is not JSON
serializable

                    On Tue, Sep 19, 2017 at

4:50 PM, Web Busino [email protected]
wrote:

                            As you can see in the traceback.

bokeh-json-encoder is not able to encode
your data.

                            ```
                            import json
                            from bokeh.core.json_encoder import

BokehJSONEncoder
data = [’ ᶇ ᶈ ᶉ ᶊ ᶋ ᶌ ᶍ ᶎ ']
json.dumps(data, cls=BokehJSONEncoder)
```

                            try to reproduce with the above code.

Replace the data with your
dataframe.

                            On

2017-09-19 13:05, Nitin Solanki wrote:

                                Even though, I dump my

Dataframe to CSV and read load
dumped CSV using pd.read_csv('file', **encoding** = "**ISO**-8859-1"). It
doesn’t work too.

                                  Issue is in "components()" of

bokeh. It is doing something
strange.

Error:

                                    Traceback (most recent call

last):

                                    File

“modules/data_profiling_sql/la yout/populate_in_html.py”,
line 342, in populate_plots_data

                                    script, plots =

components(plot_data)

                                    File

“/usr/local/lib/python2.7/dist -packages/bokeh/embed.py”,
line 233, in components

                                    (docs_json, render_items)

= _standalone_docs_json_and_render_items(models)

                                    File

“/usr/local/lib/python2.7/dist -packages/bokeh/embed.py”,
line 747, in
_standalone_docs_json_and_render_items

                                    docs_json[k] =

v.to_json()

                                    File

“/usr/local/lib/python2.7/dist -packages/bokeh/document.py”,
line 734, in to_json

                                    doc_json =

self.to_json_string()

                                    File

“/usr/local/lib/python2.7/dist -packages/bokeh/document.py”,
line 763, in to_json_string

                                    return

serialize_json(json,
indent=indent)

                                    File

“/usr/local/lib/python2.7/dist-packages/bokeh/core/json_enco der.py”,
line 226, in serialize_json

                                    return json.dumps(obj,

cls=BokehJSONEncoder,
allow_nan=False, indent=indent,
separators=separators,
sort_keys=True, **kwargs)

                                    File

“/usr/lib/python2.7/json/ini t.py”,
line 251, in dumps

                                    sort_keys=sort_keys,

**kw).encode(obj)

                                    File

“/usr/lib/python2.7/json/encod er.py”,
line 209, in encode

chunks = list(chunks)

                                    File

“/usr/lib/python2.7/json/encod er.py”,
line 434, in _iterencode

                                    for chunk in

_iterencode_dict(o,
_current_indent_level):

                                    File

“/usr/lib/python2.7/json/encod er.py”,
line 408, in _iterencode_dict

for chunk in chunks:

                                    File

“/usr/lib/python2.7/json/encod er.py”,
line 408, in _iterencode_dict

for chunk in chunks:

                                    File

“/usr/lib/python2.7/json/encod er.py”,
line 332, in _iterencode_list

for chunk in chunks:

                                    File

“/usr/lib/python2.7/json/encod er.py”,
line 408, in _iterencode_dict

for chunk in chunks:

                                    File

“/usr/lib/python2.7/json/encod er.py”,
line 408, in _iterencode_dict

for chunk in chunks:

                                    File

“/usr/lib/python2.7/json/encod er.py”,
line 408, in _iterencode_dict

for chunk in chunks:

                                    File

“/usr/lib/python2.7/json/encod er.py”,
line 313, in _iterencode_list

                                    yield buf +

_encoder(value)

                                    UnicodeDecodeError: 'utf8'

codec can’t decode byte 0xc3 in
position 19: unexpected end of
data

                                    Process finished with exit

code 1

                                      On Tue,

Sep 19, 2017 at 4:32 PM, Nitin
Solanki [email protected]
wrote:

                                          I'm not using

CSV.

                                            I created by own

pandas DataFrame without
CSV.

                                                On

Tue, Sep 19, 2017 at
4:26 PM, Hiram
Foster [email protected] wrote:

                                                    When

loading your df,
try pd.read_csv('file', **encoding** = "**ISO**-8859-1")
(Adjusting for your source and
file name).

                                                      On

Sep 19, 2017
6:02 AM,
“Nitin
Solanki” <[email protected] >
wrote:

Hello,

                                                      My pandas

Dataframe
contains below
characters.

Names

Kiljavan
Lääketutkimus

                                                      Centre

Hospitalier
Régional
Universitaire
de Montpellier

                                                      Hospital

Regional
Universitario
de Málaga

Akdeniz
Üniversitesi Hastanesi

                                                      MVZ

für
Rheumatologie
Dr. Martin
Welcker

                                                      During

rendering this
dataframe to
bokeh charts.

                                                      It throws

error - ** “UnicodeDecodeError:
‘utf8’ codec
can’t decode
byte 0xc3 in
position 19:
unexpected end
of data”**

I tried

** df[“names”]

df[“names”].apply(lambda
x:
x.decode(‘unicode_escape’).encode(‘ascii’,
‘replace’).strip())**

                                                      but it is

ignore UTF-8
Characters
that i dont’
want. *** I
need to keep
data intact***

                                                      Any help

?

Nitin

                                                      This

e-mail,
including any
attached
files, may
contain
confidential
and privileged
information
for the sole
use of the
intended
recipient. Any
review, use,
distribution,
or disclosure
by others is
strictly
prohibited. If
you are not
the intended
recipient (or
authorized to
receive
information
for the
intended
recipient),
please contact
the sender by
reply e-mail
and delete all
copies of this
message.

                                                      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/CAOUEs4UfBT1f1a7hA8oUk5eOf5-Tm%3D-9–mY2A0GCQVOgVgYrg%40mail.gmail.com.

                                                      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/CAO0BaO1EaVRSNbVwoPkk%2B3f1NC%2BO9SnQ_Uki0RybFoP8KxX31Q%40mail.gmail.com.

                                                      For more

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

                                  This e-mail,

including any attached files, may
contain confidential and
privileged information for the
sole use of the intended
recipient. Any review, use,
distribution, or disclosure by
others is strictly prohibited. If
you are not the intended recipient
(or authorized to receive
information for the intended
recipient), please contact the
sender by reply e-mail and delete
all copies of this message.

                              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/CAOUEs4X4xbKP%2BGHPQLGtOuz3qVHQAZV3aR6WFvuMT%2BEnAqeW8Q%40mail.gmail.com.

                            For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
                    This

e-mail, including any attached files, may
contain confidential and privileged information
for the sole use of the intended recipient. Any
review, use, distribution, or disclosure by
others is strictly prohibited. If you are not
the intended recipient (or authorized to receive
information for the intended recipient), please
contact the sender by reply e-mail and delete
all copies of this message.

                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/CAOUEs4Wzo5GWNhhQJT2t7aH-_yhYMjVXz%2BRv7J1umy2MgmCQ3Q%40mail.gmail.com.

              For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
      This e-mail,

including any attached files, may contain confidential and
privileged information for the sole use of the intended
recipient. Any review, use, distribution, or disclosure by
others is strictly prohibited. If you are not the intended
recipient (or authorized to receive information for the
intended recipient), please contact the sender by reply e-mail
and delete all copies of this message.