在Qgrid中,有没有一种方法可以在显示表时应用默认行过滤器

我在文档中找不到一种方法来显示与预先过滤的数据框相关的qgrid表

想象一下我有一个像这样的数据框:

df_types = pd.DataFrame({
'A' : 1.,'B' : 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]'),'C' : pd.Series(randn(9),dtype='float32'),'D' : np.array([3] * 9,dtype='int32'),'E' : pd.Categorical(["washington","adams","washington","madison","lincoln","jefferson","hamilton","roosevelt","kennedy"]),'F' : ["foo","bar","buzz","bippity","boppity","foo","zoo"] })

,最初显示表时,我只想显示列“ F”等于foobar而不是全部的行(但仍然可以在qgrid中选择其他行)标题)

zb415 回答:在Qgrid中,有没有一种方法可以在显示表时应用默认行过滤器

在qgrid github上读取了一些测试文件后。下面的代码可能会有所帮助。但是,可见行与单击过滤器相比看起来有所不同。

qw = qgrid.show_grid(df_types,show_toolbar=True)
qw._handle_qgrid_msg_helper({
        'type': 'show_filter_dropdown','field': 'F','search_val': 'bar'
    })
qw._handle_qgrid_msg_helper({
        'field': "F",'filter_info': {
            'field': "F",'selected': [0],'type': "text",'excluded': []
        },'type': "change_filter"
    })
本文链接:https://www.f2er.com/3148176.html

大家都在问