python pandas多列筛选

# -*- coding: utf-8 -*-
#from dao.updateMongo import *
#from dao.insertMongo import *
#from dao.selectMongo import *
 
import pandas as pd
 
#df = selectDataFrame(find={},col_name='sttemp')
#df.pop('_id')
#df.to_csv('.\output\目标.csv',encoding='gbk')
 
 
 
#加encoding=‘gbk'  因为文件中存在中文, 功能--- 输出多个并行条件的表格数据 
#这里的筛选条件可以根据用户需要进行修改
 
df1 =pd.read_csv(u'.\output\目标.csv', encoding='gbk')
 
outfile = df1[(df1[u'found']==True) & (df1['DtoE'] >= 0) & (df1['DtoE'] <= 4) &  (df1['E'] >= '2021-10-01')]
print(outfile)
outfile.to_csv('final_target.csv', index=False, encoding='gbk')
 
print("===========运行结束 文件已导出 ============")

 

posted @ 2023-08-24 10:32  myrj  阅读(101)  评论(0编辑  收藏  举报