如果列中的值位于值的集合列表[重复]中,则筛选数据行
rpt
:
rpt<class 'pandas.core.frame.DataFrame'>MultiIndex: 47518 entries, ('000002', '20120331') to ('603366', '20091231')Data columns:STK_ID 47518 non-null values STK_Name 47518 non-null values RPT_Date 47518 non-null values sales 47518 non-null values
'600809'
rpt[rpt['STK_ID'] == '600809']
<class 'pandas.core.frame.DataFrame'>MultiIndex: 25 entries, ('600809', '20120331') to ('600809', '20060331')Data columns:STK_ID 25 non-null values STK_Name 25 non-null values RPT_Date 25 non-null values sales 25 non-null values
['600809','600141','600329']
stk_list = ['600809','600141','600329']rst = rpt[rpt['STK_ID'] in stk_list] # this does not works in pandas
元芳怎么了
料青山看我应如是
相关分类