# Non-English Column Names

**URL:** <https://discourse.bokeh.org/t/non-english-column-names/11257>\
**Category:** Community Support\
**Tags:** columndatasource, hover, bokeh\
**Created:** [February 13, 2024, 8:53am UTC](https://discourse.bokeh.org/t/non-english-column-names/11257 "2024-02-13T08:53:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gen](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/gen/32/6018_2.png) [@Gen](https://discourse.bokeh.org/u/Gen)\
**Post date:** [February 13, 2024, 8:53am UTC](https://discourse.bokeh.org/t/non-english-column-names/11257/1 "2024-02-13T08:53:02Z")

</div>

Can Bokeh’s `Hovertool` print data if the Column name is non-English in a `ColumnDataSource`?

Here’s a quick example:

```auto
import pandas as pd
from bokeh.models.sources import ColumnDataSource
from bokeh.plotting import figure, show
from bokeh.models.tools import HoverTool

# Set up the data
non_english_col_name = '名前'
df = pd.DataFrame({
    non_english_col_name: ['a','b'],
    'x': [1,2],
    'y': [0,3]
})
source = ColumnDataSource(df)

# Create the glyphs
p = figure()
scatter = p.scatter(source = source)

# Create the Hovertool

hover_tool = HoverTool(renderers=[scatter],
                       tooltips=[('Name', f'@{non_english_col_name}'),
                                 ('x','@x'),
                                 ('y','@y')]
)
p.add_tools(hover_tool)
show(p)

```

Both `x` and `y` show up fine in the Hover, but the non-English column name (`non_english_col_name`) doesn’t display the data and treats it as a string literal. Is there a workaround for this other than re-naming the column name to an English name?

![Screenshot 2024-02-13 at 17.51.56](https://discourse-uploads.bokeh.org/original/2X/c/ce41f598c3202e84f2e97a431948f88dc454abfe.png)

---

<div class="post-metadata">

**Author:** ![Bryan](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/bryan/32/3625_2.png) [@Bryan](https://discourse.bokeh.org/u/Bryan)\
**Post date:** [February 13, 2024, 5:48pm UTC](https://discourse.bokeh.org/t/non-english-column-names/11257/2 "2024-02-13T17:48:35Z")

</div>

@Gen column names that have spaces or sometimes other special characters in then Bokeh requires them to be enclosed in curly braces in the tooltip string. \[1\] Considering you are using an f-string as well, you will also have to use Python escape syntax for the literal braces, and it ends up looking like this, with three braces on each side:

```python
tooltips=[('Name', f'@{{{non_english_col_name}}}')

```

This is mentioned in the middle of the [Basic Tooltips](https://docs.bokeh.org/en/latest/docs/user_guide/interaction/tools.html#hovertool) section of the docs.

* * *

1. It’s also possible to just _always_ use curly braces around column names e.g. to be consistent and not have to worry about which cases require them.

---

<div class="post-metadata">

**Author:** ![Gen](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/gen/32/6018_2.png) [@Gen](https://discourse.bokeh.org/u/Gen)\
**Post date:** [February 14, 2024, 5:52am UTC](https://discourse.bokeh.org/t/non-english-column-names/11257/3 "2024-02-14T05:52:55Z")

</div>

Thank you, this is extremely helpful. I will just always make it a rule to use curly braces!

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads.bokeh.org/original/2X/1/14eb24f9e10e4e9b78e3f10f66c04ffa96446e5a.svg) [@system](https://discourse.bokeh.org/u/system)\
**Post date:** [May 14, 2024, 5:53am UTC](https://discourse.bokeh.org/t/non-english-column-names/11257/4 "2024-05-14T05:53:18Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
