Black Lives Matter. Please consider donating to Black Girls Code today.

Dash_table numeric formatting "symbol" use

I’m trying to format my table columns so that they are written with units in the cells. I have made an example from the quickstart example in the tutorial, only that I’ve made a new csv file where e.g. 100 MW is stored as 100000000 to let the data_table format option take care of the SI-prefix. As far as I understand the documentation, I should be able to add a W at the end by adding "locale": {"symbol": ["", "W"]} to the "format" dict, but it doesn’t seem to work. See code below. Also, when adding SI-prefix to the number formatting, I would like to be able to have a space before the e.g. M for 1e6, but I haven’t found a way to do that? (as a number with SI-units should be written e.g. 1 MW and not 1MW).

import dash
import dash_table
import pandas as pd

df = pd.read_csv("./solar_plant_data.csv")

app = dash.Dash(__name__)

app.layout = dash_table.DataTable(
    columns=[{"name": i, "id": i, "type": "numeric", "format": {'locale': {'symbol': ['', 'W']}, 'specifier': '.3s'}} for i in df.columns],

if __name__ == '__main__':

Found that I had to write ‘$.3s’ in the specifier to write the unit, but I still cannot make a space before the SI-prefix, and it seems like it is not implemented. Made an issue:

Does 'symbol': ['', ' W'] work?

No, if you look at the github issue, I tried to do that. You get a space between the prefix and the unit, not between the unit and the prefix. There is a picture of it in the issue where you see a space between k and W