qgrid icon indicating copy to clipboard operation
qgrid copied to clipboard

How do I set number display format?

Open zit-cat opened this issue 5 years ago • 2 comments

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!

zit-cat avatar Sep 10 '19 17:09 zit-cat

Agreed. .2f or .2g would be great features. In general some customizable table cell renderer might be useful.

dpdoughe avatar Apr 07 '20 21:04 dpdoughe

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 picture

glima20 avatar Oct 01 '20 10:10 glima20