天宫鹤

2024年7月28日

Python去除UserWarning: Data Validation extension is not supported and will be removed warn(msg)警告信息

摘要: # 忽略UserWarning: Data Validation extension的警告(Excel读取时出现)warnings.simplefilter(action='ignore', category=UserWarning) 阅读全文

posted @ 2024-07-28 16:37 GoGrid 阅读(1) 评论(0) 推荐(0) 编辑

2024年7月22日

Python获取指定文件夹下的目标文件文件夹(倒数第二个文件夹)的全路径列表

摘要: # 获取指定文件夹下的目标文件文件夹(倒数第二个文件夹)的全路径列表 def get_destination_folder_list(_path, _pattern='1.*'): """ :param _path:指定文件夹 :param _pattern:文件匹配模式,默认.jpg 功能:返回指 阅读全文

posted @ 2024-07-22 07:53 GoGrid 阅读(3) 评论(0) 推荐(0) 编辑

2024年7月18日

Python按照图片尺寸(毫米mm)调整图片尺寸(像素pixel)

摘要: # 按照图片尺寸(毫米mm)调整图片尺寸(像素) def resize_image_by_mm(input_image_path, output_image_path, width_mm=35, height_mm=49): """ 输入参数: :param input_image_path:原图片 阅读全文

posted @ 2024-07-18 21:21 GoGrid 阅读(2) 评论(0) 推荐(0) 编辑

Python获取EXCEL实用行数

摘要: # 获取EXCEL实用行数 def get_excel_rows(_excel_path): """ 输入参数: :param _excel_path:Excel全路径 功能:获取Excel实际行数,即培训人员数量 """ if not _excel_path.exists(): print(f'{ 阅读全文

posted @ 2024-07-18 11:42 GoGrid 阅读(2) 评论(0) 推荐(0) 编辑

2024年7月17日

Python读Excel数据,创建Word文档上下文字典列表,元素为字典(新)

摘要: # 读Excel数据,创建Word文档上下文字典列表,元素为每个培训人员的上下文字典 def create_docx_context_dict_list(_excel_path): """ 输入参数: :param _excel_path:Excel全路径 功能:创建Word文档上下文字典列表,元素 阅读全文

posted @ 2024-07-17 22:05 GoGrid 阅读(1) 评论(0) 推荐(0) 编辑

Python使用指定数据、索引、列名创建DataFrame

摘要: data = [[109, 119, 98], [106, 99, 85], [108, 110, 104], [102, 99]] # 数据 name = ['King', 'Order', 'God', 'Dd'] # 索引 columns = ['语文', '数学', "英语"] # 列名 d 阅读全文

posted @ 2024-07-17 17:17 GoGrid 阅读(3) 评论(0) 推荐(0) 编辑

Python解决FutureWarning: Passing literal html to 'read_html' is deprecated and will be removed in a future version. To read from a literal string, wrap it in a 'StringIO' object.

摘要: from io import StringIO try: resp = requests.get(url) # pd.set_option('future.no_silent_downcasting', True) # 不提示函数在未来版本中将被替代的警告 df = pd.read_html(Str 阅读全文

posted @ 2024-07-17 16:54 GoGrid 阅读(24) 评论(0) 推荐(0) 编辑

2024年7月15日

Python读Excel数据,创建Word文档上下文字典列表,元素为字典

摘要: # 读Excel数据,创建Word文档上下文字典列表,元素为每个培训人员的上下文字典 def read_sheet(_path_excel): """ :param _path_excel:Excel全路径 功能:读Excel数据,创建Word文档上下文字典列表,元素为每个培训人员的上下文字典 字典 阅读全文

posted @ 2024-07-15 18:07 GoGrid 阅读(2) 评论(0) 推荐(0) 编辑

2024年7月11日

Python获取指定文件夹下倒数第二个文件夹的全路径列表

摘要: # 获取指定文件夹下倒数第二个文件夹的全路径列表 def get_penultimate_folder_list(path): """ :param path:指定文件夹 功能:返回指定文件夹下倒数第二个文件夹的全路径列表 """ path = Path(path) assert path.exis 阅读全文

posted @ 2024-07-11 10:06 GoGrid 阅读(3) 评论(0) 推荐(0) 编辑

2024年7月6日

Python以边沿裁剪图片

摘要: 1 # 以边沿裁剪图片 2 def crop_image_by_border(image, l_mm=0, t_mm=0, r_mm=0, b_mm=0): 3 # 计算新的宽度和高度(像素单位) 4 l_dot = int(l_mm / inch_to_mm * dpi) # 左边 5 t_dot 阅读全文

posted @ 2024-07-06 17:14 GoGrid 阅读(1) 评论(0) 推荐(0) 编辑

导航