qgrid
qgrid copied to clipboard
How do I set number display format?
Environment
- Operating System: Mac
- Python Version: 3.7.3
- How did you install Qgrid: conda-forge
- Jupyter notebook
How do I customize the number display format? For example, I'd like all floats to be displayed as .2f
. I tried something like pd.options.display.float_format = '${:,.2f}'.format
but that only works outside of qgrid. Thanks!
Agreed. .2f or .2g would be great features. In general some customizable table cell renderer might be useful.
I changed the float format considering a certain column (e.g Column B), but the slider filter isn't in line with the values in the Column B, why?
import numpy as np import pandas as pd import qgrid randn = np.random.randn df_types = pd.DataFrame({ 'A' : pd.Series(['2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04', '2013-01-05', '2013-01-06', '2013-01-07', '2013-01-08', '2013-01-09'],index=list(range(9)),dtype='datetime64[ns]'), 'B' : pd.Series(randn(9),index=list(range(9)),dtype='float32'), 'C' : pd.Categorical(["washington", "adams", "washington", "madison", "lincoln","jefferson", "hamilton", "roosevelt", "kennedy"]), 'D' : ["foo", "bar", "buzz", "bippity","boppity", "foo", "foo", "bar", "zoo"] }) df_types['E'] = df_types['D'] == 'foo' df_types = df_types.round({"B": 2}) qgrid_widget = qgrid.show_grid(df_types, show_toolbar=True) qgrid_widget