printlog("step1: preparing data...") dfdata,dftest = titanic() display(dfdata.head()) label_col = "Survived"
时间: 2024-03-19 18:40:38 浏览: 74
这段代码是在做什么?
这段代码首先调用了名为“titanic”的函数,该函数返回两个数据框:dfdata和dftest。然后,它使用display函数显示dfdata中的前几行。最后,它将一个字符串“Survived”赋值给label_col变量。这段代码的目的是准备数据,其中“Survived”列是标签列,表示乘客是否在泰坦尼克号沉没事故中幸存。
相关问题
JDBC Connection [org.postgresql.jdbc.PgConnection@49f1bf43] will not be managed by Spring ==> Preparing: select z.*,y.PDTCLASS_CLASS FROM ( SELECT * FROM (SELECT r.PDT_PLANEX_PDTID,r.PDT_PLANEX_TYPE ,r.SUM_NUM,e.SUM_NUM2,e.COUNT_NUM FROM (SELECT SUM(t.PDT_PLANEX_NUM) as SUM_NUM,t.PDT_PLANEX_PDTID,t.PDT_PLANEX_TYPE FROM c_pdt_plan_ex t WHERE t.PDT_PLANEX_DELETED = 0 and t.DATA_FROM = ? and to_timestamp(?, 'yyyy-MM-dd HH:mm:ss.SSS') >= t.PDT_PLANEX_BEGIN and t.PDT_PLANEX_END >= to_timestamp(?, 'yyyy-MM-dd HH:mm:ss.SSS') GROUP BY t.PDT_PLANEX_PDTID,t.PDT_PLANEX_TYPE )r LEFT JOIN (SELECT SUM(o.WEISHT_NET_WGHT) SUM_NUM2,COUNT(1) COUNT_NUM,o.PDTINF_PDT,o.PDTINF_CLASS,o.PDT_PLANEX_PDTID,o.PDT_PLANEX_TYPE FROM(SELECT * FROM(SELECT * FROM (SELECT q.*, p.* FROM ( SELECT t.PDT_PLANEX_ID, t.PDT_PLANEX_NUM, t.PDT_PLANEX_PDTID, t.PDT_PLANEX_TYPE, t.PDT_PLANEX_BEGIN, t.PDT_PLANEX_END, t.PDT_PLANEX_COID FROM c_pdt_plan_ex t WHERE t.PDT_PLANEX_DELETED = 0 and t.DATA_FROM = ? and to_timestamp(?, 'yyyy-MM-dd HH:mm:ss.SSS') >= t.PDT_PLANEX_BEGIN and t.PDT_PLANEX_END >= to_timestamp(?, 'yyyy-MM-dd HH:mm:ss.SSS') GROUP BY t.PDT_PLANEX_PDTID, t.PDT_PLANEX_COID, t.PDT_PLANEX_TYPE, t.PDT_PLANEX_BEGIN, t.PDT_PLANEX_END, t.PDT_PLANEX_COID ) q LEFT JOIN (SELECT PDTINF_PDT, PDTINF_ID , PDTINF_CLASS FROM c_products_info WHERE PDTINF_DELETED=0 and DATA_FROM = ? )p on q.PDT_PLANEX_PDTID=p.PDTINF_ID)k LEFT JOIN (select g.CPY_CO,g.CPY_ID from c_companys g where CPY_DELETED=0 and DATA_FROM = ? ) c ON k.PDT_PLANEX_COID=c.CPY_ID)k inner JOIN (select j.WEISHT_NET_WGHT,j.WEISHT_PRODUCT,j.WEISHT_CO,j.WEISHT_EMPTY_TM,j.WEISHT_FULL_TM from c_weight_sheets j where WEISHT_DELETED = 0 and DATA_FROM = ? )r ON k.PDTINF_PDT=r.WEISHT_PRODUCT and k.CPY_CO=r.WEISHT_CO AND k.PDT_PLANEX_BEGIN <= r.WEISHT_FULL_TM AND k.PDT_PLANEX_END >= r.WEISHT_FULL_TM ORDER BY k.PDTINF_PDT )o GROUP BY o.PDT_PLANEX_PDTID)e ON e.PDT_PLANEX_PDTID=r.PDT_PLANEX_PDTID AND e.PDT_PLANEX_TYPE=r.PDT_PLANEX_TYPE)w left join (SELECT PDTINF_PDT, PDTINF_ID , PDTINF_CLASS FROM c_products_info WHERE PDTINF_DELETED=0 and DATA_FROM = ? )p on w.PDT_PLANEX_PDTID=p.PDTINF_ID) z left join (select PDTCLASS_CLASS,PDTCLASS_ID from c_pdt_class where PDTCLASS_DELETED=0) y on z.PDTINF_CLASS=y.PDTCLASS_ID ==> Parameters: e9f6ed8e091611ec842700163e092c06(String), 2023-10-08 23:59:59(String), 2020-10-08 23:59:59(String), e9f6ed8e091611ec842700163e092c06(String), 2023-10-08 23:59:59(String), 2020-10-08 23:59:59(String), e9f6ed8e091611ec842700163e092c06(String), e9f6ed8e091611ec842700163e092c06(String), e9f6ed8e091611ec842700163e092c06(String), e9f6ed8e091611ec842700163e092c06(String) Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@57f98196] [2023-06-01 21:16:02] [ERROR] -- Servlet.service() for servlet [dispatcherServlet] in context with path [/szIntranetweb] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: ### Error querying database. Cause: org.postgresql.util.PSQLException: 错误: 字段 "t.pdt_planex_id" 必须出现在 GROUP BY 子句中或者在聚合函数中使用
这段代码看起来像是在执行一个 SQL 查询语句,但是出现了一个错误:字段 "t.pdt_planex_id" 必须出现在 GROUP BY 子句中或者在聚合函数中使用。这个错误通常是由于 SQL 查询语句中的 GROUP BY 子句不完整导致的。可能需要检查一下查询语句中的 GROUP BY 子句是否正确,并且检查一下对应的数据库表结构是否符合要求。
帮我修复一下这个bugJDBC Connection [org.postgresql.jdbc.PgConnection@49f1bf43] will not be managed by Spring ==> Preparing: select z.,y.PDTCLASS_CLASS FROM ( SELECT * FROM (SELECT r.PDT_PLANEX_PDTID,r.PDT_PLANEX_TYPE ,r.SUM_NUM,e.SUM_NUM2,e.COUNT_NUM FROM (SELECT SUM(t.PDT_PLANEX_NUM) as SUM_NUM,t.PDT_PLANEX_PDTID,t.PDT_PLANEX_TYPE FROM c_pdt_plan_ex t WHERE t.PDT_PLANEX_DELETED = 0 and t.DATA_FROM = ? and to_timestamp(?, 'yyyy-MM-dd HH:mm:ss.SSS') >= t.PDT_PLANEX_BEGIN and t.PDT_PLANEX_END >= to_timestamp(?, 'yyyy-MM-dd HH:mm:ss.SSS') GROUP BY t.PDT_PLANEX_PDTID,t.PDT_PLANEX_TYPE )r LEFT JOIN (SELECT SUM(o.WEISHT_NET_WGHT) SUM_NUM2,COUNT(1) COUNT_NUM,o.PDTINF_PDT,o.PDTINF_CLASS,o.PDT_PLANEX_PDTID,o.PDT_PLANEX_TYPE FROM(SELECT * FROM(SELECT * FROM (SELECT q., p.* FROM ( SELECT t.PDT_PLANEX_ID, t.PDT_PLANEX_NUM, t.PDT_PLANEX_PDTID, t.PDT_PLANEX_TYPE, t.PDT_PLANEX_BEGIN, t.PDT_PLANEX_END, t.PDT_PLANEX_COID FROM c_pdt_plan_ex t WHERE t.PDT_PLANEX_DELETED = 0 and t.DATA_FROM = ? and to_timestamp(?, 'yyyy-MM-dd HH:mm:ss.SSS') >= t.PDT_PLANEX_BEGIN and t.PDT_PLANEX_END >= to_timestamp(?, 'yyyy-MM-dd HH:mm:ss.SSS') GROUP BY t.PDT_PLANEX_PDTID, t.PDT_PLANEX_COID, t.PDT_PLANEX_TYPE, t.PDT_PLANEX_BEGIN, t.PDT_PLANEX_END, t.PDT_PLANEX_COID ) q LEFT JOIN (SELECT PDTINF_PDT, PDTINF_ID , PDTINF_CLASS FROM c_products_info WHERE PDTINF_DELETED=0 and DATA_FROM = ? )p on q.PDT_PLANEX_PDTID=p.PDTINF_ID)k LEFT JOIN (select g.CPY_CO,g.CPY_ID from c_companys g where CPY_DELETED=0 and DATA_FROM = ? ) c ON k.PDT_PLANEX_COID=c.CPY_ID)k inner JOIN (select j.WEISHT_NET_WGHT,j.WEISHT_PRODUCT,j.WEISHT_CO,j.WEISHT_EMPTY_TM,j.WEISHT_FULL_TM from c_weight_sheets j where WEISHT_DELETED = 0 and DATA_FROM = ? )r ON k.PDTINF_PDT=r.WEISHT_PRODUCT and k.CPY_CO=r.WEISHT_CO AND k.PDT_PLANEX_BEGIN <= r.WEISHT_FULL_TM AND k.PDT_PLANEX_END >= r.WEISHT_FULL_TM ORDER BY k.PDTINF_PDT )o GROUP BY o.PDT_PLANEX_PDTID)e ON e.PDT_PLANEX_PDTID=r.PDT_PLANEX_PDTID AND e.PDT_PLANEX_TYPE=r.PDT_PLANEX_TYPE)w left join (SELECT PDTINF_PDT, PDTINF_ID , PDTINF_CLASS FROM c_products_info WHERE PDTINF_DELETED=0 and DATA_FROM = ? )p on w.PDT_PLANEX_PDTID=p.PDTINF_ID) z left join (select PDTCLASS_CLASS,PDTCLASS_ID from c_pdt_class where PDTCLASS_DELETED=0) y on z.PDTINF_CLASS=y.PDTCLASS_ID ==> Parameters: e9f6ed8e091611ec842700163e092c06(String), 2023-10-08 23:59:59(String), 2020-10-08 23:59:59(String), e9f6ed8e091611ec842700163e092c06(String), 2023-10-08 23:59:59(String), 2020-10-08 23:59:59(String), e9f6ed8e091611ec842700163e092c06(String), e9f6ed8e091611ec842700163e092c06(String), e9f6ed8e091611ec842700163e092c06(String), e9f6ed8e091611ec842700163e092c06(String) Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@57f98196] [2023-06-01 21:16:02] [ERROR] -- Servlet.service() for servlet [dispatcherServlet] in context with path [/szIntranetweb] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: ### Error querying database. Cause: org.postgresql.util.PSQLException: 错误: 字段 "t.pdt_planex_id" 必须出现在 GROUP BY 子句中或者在聚合函数中使用
这个错误是因为 SQL 查询语句中的某些字段没有在 GROUP BY 子句中出现,也没有使用聚合函数进行处理。你需要根据错误提示中提到的字段名,检查查询语句中是否缺少了 GROUP BY 或聚合函数的处理。如果你不确定如何修改查询语句,可以将完整的查询语句以及查询的数据表结构提供给有经验的 DBA 或开发人员进行修复。
阅读全文