随笔分类 -  python

摘要:使用encoding参数: pd.read_csv(path,sep=",",encoding='utf-16') 注意:该参数之后的编码格式,并不是固定的,需要用记事本打开csv文件,查看csv文件格式的编码。 阅读全文
posted @ 2020-10-26 14:29 胸怀丶若谷 阅读(699) 评论(0) 推荐(0) 编辑
摘要:#设置列宽 cell_width_list = [12, 8.5, 29, 12.5, 13, 10.5] # 列名 column_names = ['A', 'B', 'C', 'D', 'E', 'F'] count = 0 for column_name in column_names: wo 阅读全文
posted @ 2020-10-26 09:59 胸怀丶若谷 阅读(105) 评论(0) 推荐(0) 编辑
摘要:class A: def a(self): print("hello world") def b(self): return self.a() 阅读全文
posted @ 2020-10-21 13:04 胸怀丶若谷 阅读(2394) 评论(0) 推荐(1) 编辑
摘要:合并单元格时,除左上角的单元格外,所有单元格都是 远离的 从工作表中。为了携带合并单元格的边框信息,将合并单元格的边框单元格创建为始终具有值“无”的合并单元格。见 设置合并单元格的样式 有关设置合并单元格格式的信息。 >>> from openpyxl.workbook import Workboo 阅读全文
posted @ 2020-10-21 09:43 胸怀丶若谷 阅读(553) 评论(0) 推荐(0) 编辑
摘要:import pandas as pd # 显示所有列,所有行 pd.set_option('display.max_columns', None) pd.set_option('display.max_rows', None) 参考链接:https://www.jb51.net/article/1 阅读全文
posted @ 2020-10-20 19:16 胸怀丶若谷 阅读(2312) 评论(0) 推荐(0) 编辑
摘要:writer = pd.ExcelWriter('/home/leo/Desktop/项目测试/922904.xlsx', engine='openpyxl') new_data.to_excel(writer, index=False, sheet_name="Sheet1") # 设置表格样式 阅读全文
posted @ 2020-10-20 15:21 胸怀丶若谷 阅读(1249) 评论(0) 推荐(0) 编辑
摘要:打开终端,输入如下命令: sudo apt-get update sudo apt-get install python3-tk 阅读全文
posted @ 2020-10-07 09:44 胸怀丶若谷 阅读(1175) 评论(0) 推荐(0) 编辑
摘要:方案一: 进入项目路径,在cmd窗口输入python 文件名。之后查看结果,看是否有模块未安装,或者是未导入模块。因为pyinstaller打包时,是按照被打包文件上的导入的库名进行打包的,所以需要将所有导入的模块声明放入这个文件中。 方案二: 参考链接:https://www.pianshen.c 阅读全文
posted @ 2020-08-27 08:53 胸怀丶若谷 阅读(1439) 评论(0) 推荐(0) 编辑
摘要:找遍资料终于找到了解决方法: 在脚本开头import这个module即可,这个可能是某个编码的问题,没有深究,解决就好import encodings.idna 阅读全文
posted @ 2020-08-14 10:05 胸怀丶若谷 阅读(981) 评论(0) 推荐(0) 编辑
摘要:# 设置单元格格式 # 日期所在的列 datelist = [16, 17, 18] for row in range(2, rows3 + 1): for column in datelist: datevalue = ws.cell(row=row, column=column).value # 阅读全文
posted @ 2020-07-28 10:57 胸怀丶若谷 阅读(267) 评论(0) 推荐(0) 编辑
摘要:把字符串转换成日期 import datetime #引入datetime模块 time= datetime.strptime('2018-4-19 11:19:59','%Y-%m-%d %H:%M:%S') #把字符串转换成时间 print time #输出时间信息 把日期转换成字符串 impo 阅读全文
posted @ 2020-07-28 09:09 胸怀丶若谷 阅读(86) 评论(0) 推荐(0) 编辑
摘要:bool = ExcelDataStr.str.contains("Item No./Customer/Saler") # 初始位置:initial position, 终位置:end position initial_position = ExceclData[bool].index.tolist 阅读全文
posted @ 2020-07-23 15:22 胸怀丶若谷 阅读(1303) 评论(0) 推荐(0) 编辑
摘要:cmd下执行 你的路径\AccessDatabaseEngine.exe /quiet 转载于:https://www.cnblogs.com/64mb/p/10844676.html 阅读全文
posted @ 2020-07-22 16:57 胸怀丶若谷 阅读(4831) 评论(0) 推荐(0) 编辑
摘要:与:&& 或:|| 非:! 阅读全文
posted @ 2020-07-17 15:28 胸怀丶若谷 阅读(209) 评论(0) 推荐(0) 编辑
摘要:df = df[df['my_col'].notnull()] 阅读全文
posted @ 2020-07-10 16:24 胸怀丶若谷 阅读(4621) 评论(0) 推荐(0) 编辑
摘要:1 import tkinter as tk 2 root = tk.Tk() 3 root.withdraw() 阅读全文
posted @ 2020-07-10 09:59 胸怀丶若谷 阅读(176) 评论(0) 推荐(0) 编辑
摘要:# 统一表格样式 rows = ws.max_row columns = ws.max_column # print(rows) # print(columns) for row in range(1, rows+1): for column in range(1, columns+1): ws.c 阅读全文
posted @ 2020-07-10 09:49 胸怀丶若谷 阅读(655) 评论(0) 推荐(0) 编辑
摘要:文章参考: https://hant-kb.kutu66.com/others/post_13460379 在浏览器设置参数时加入如下两行代码 1 # 取消沙盒模式 2 options.add_argument("--no-sandbox") 3 # 这一行我也不清楚 4 options.add_a 阅读全文
posted @ 2020-07-10 09:11 胸怀丶若谷 阅读(668) 评论(0) 推荐(0) 编辑
摘要:1 # 边框线 2 border_set = Border(left=Side(border_style='thin', color='000000'), 3 right=Side(border_style='thin', color='000000'), 4 top=Side(border_sty 阅读全文
posted @ 2020-07-10 09:06 胸怀丶若谷 阅读(3590) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示