quantopian/qgrid

Formatting Pandas DataFrame in qgrid to round float number and relative filter (slider)

glima20 opened this issue · 1 comments

Environment

  • Operating System: Ubuntu 19.10
  • Python Version: `$ 3.7.5
  • How did you install Qgrid: pip
  • Python packages: $ pip freeze or $ conda list
  • qgrid 1.3.1
  • jupyter-client 6.1.2
  • jupyter-core 4.6.3
  • jupyterlab not installed
  • Jupyter lab packages not installed

Description of Issue

  • What did you expect to happen?
    I changed the float format using df.round (would be useful change the format using the column_definitions).
    Anyway the slider filter isn't in line with the values in the columns, why?

  • What happened instead?
    the slider filter could be in line with the values rounded in the columns

Reproduction Steps

import pandas as pd
import qgrid
col_def = { 'B': {"Slick.Editors.Float.DefaultDecimalPlaces":2}
}

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([300.2345,300.2345, 300.23451, 300.2345100,300.234590, 300.23458, 300.23459, 300.234510, 300.234510],dtype='float64')
})
qgrid_widget = qgrid.show_grid(df_types, show_toolbar=True, column_definitions=col_def)
qgrid_widget
aaa

I used also the parameter : precision (integer) – The number of digits of precision to display for floating-point values. If unset, we use the value of pandas.get_option(‘display.precision’).

"qgrid.show_grid(df, show_toolbar=False, column_definitions=col_def, precision=1)".

But I can't set the individual columns, right?