Python
future_pei
代码明灭知对错,人海浮沉辨人心
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[cx_oracle]报错:expecting string or bytes object
目标:将dataframe直接批量插入Oracle数据库语句:# coding=utf-8#设置语言环境import osos.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'#设置数据库链接import cx_Oraclefrom sqlalchemy import create_engineconn_strin...原创 2019-02-21 16:31:29 · 5931 阅读 · 0 评论 -
[cx_oralce]加速批量插入dataframe到oracle
在stack overflow上看到的大牛:from sqlalchemy import types,create_enginedtyp = {c:types.VARCHAR(df[c].str.len().max()) for c in df.columns[df.dtypes == 'object'].tolist()}df.to_sql(..., dtype=d...翻译 2019-02-21 16:57:54 · 2154 阅读 · 1 评论 -
python时间格式转化:%Y-%m-%d %H:%M:%S转成%Y/%m/%d %H:%M:%S
如a = "2019-02-1823:40:00",想改为 a = "2019/02/18 23:40:00"方法:先转换为时间数组,然后转换为其他格式如下:timeArray = time.strptime(a, "%Y-%m-%d %H:%M:%S")otherStyleTime = time.strftime("%Y/%m/%d %H:%M:%S", timeArray)...转载 2019-02-18 16:08:37 · 37922 阅读 · 1 评论 -
Python 3.x提取数据某一行或某一列或特定位置元素
[python自学之路bug记录]https://blog.youkuaiyun.com/q124467623/article/details/79647333转载 2019-02-18 11:18:00 · 6058 阅读 · 0 评论 -
【python】用cx_Oracle修改oracle数据库的值
[python自学之路bug记录]网上找的都不能用,费了老半天劲才弄好,还是得多去国外的网站上看看啊。https://learncodeshare.net/2015/07/02/update-crud-using-cx_oracle/curs = conn.cursor() # 创建游标statement = "UPDATE 表名 SET 待修改列名 = :v WHERE 条件...原创 2019-02-15 21:45:40 · 1764 阅读 · 1 评论 -
【python】cx_Oracle.DatabaseError: ORA-12541: TNS:no listener 问题解决
[python自学之路bug记录]前提:(1)安装Oracle 11.20g在前,python3.72和cx_Oracle在后,均为windows 7 (64位)(2)cx_Oracle安装:https://cx-oracle.readthedocs.io/en/latest/installation.html#quick-start-cx-oracle-installation...翻译 2019-01-23 18:05:57 · 9351 阅读 · 0 评论 -
Connection to Python debugger failed Socket closed 问题解决
[python自学之路bug记录]原因:给.py文件起名字和python自带的模块重名解决办法:修改项目中的重名模块即可原创 2019-01-23 16:57:21 · 10123 阅读 · 4 评论 -
[oracle]新建字段查询:标识符无效
原因:列名为小写或者大小写混用解决办法:1.改小写为大写:https://blog.youkuaiyun.com/chenleihappy/article/details/80758363该方法没试,但是可以用另一个办法代替:在PLSQL Developer中对该表直接重新复制一张,该软件会自动将列名改成全部大写,然后导入原表的数据即可:insert into table1 select...原创 2019-02-27 10:54:44 · 2114 阅读 · 0 评论
分享