Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I set number display format? #273

Open
zit-cat opened this issue Sep 10, 2019 · 2 comments
Open

How do I set number display format? #273

zit-cat opened this issue Sep 10, 2019 · 2 comments

Comments

@zit-cat
Copy link

zit-cat commented Sep 10, 2019

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!

@dpdoughe
Copy link

dpdoughe commented Apr 7, 2020

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

@glima20
Copy link

glima20 commented Oct 1, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants