sqltxt = ''' select t.grda_code, t.grda_xm, e.csrq, t.ym_mc, t.jz_sj, t.jz_zc, t.ym_yxq, t.ym_ph, t.ym_bm, t.ymsccj_mc, t.jzdd_mc, t.jzdd_dm from inoc_jzjl t, grda_cr e where e.grda_cr_lsh = t.grda_et_lsh and t.config_ymxx_lsh in ('2901','2902','2903','2904','2905','2906') and t.jz_sj>=to_date('2021-01-01','yyyy-mm-dd') and jcqk='1' ''' jzjl=pd.read_sql(sqltxt,con) jzjl.columns=[str(item).lower() for item in jzjl.columns] jzjl['jz_sj']=jzjl['jz_sj'].dt.date jzjl['csrq']=pd.to_datetime(jzjl['csrq'],format='%Y%m%d') jzjl=jzjl[jzjl['ym_ph'].isin(['20210411','20210310','20210205','20210206','20201212','20210102'])] test=jzjl test...