摘要: import pandas as pd import os # 用os.walk遍历文件;用.endswith判断文件后缀 dfs = pd.DataFrame() for root, dirs, files in os.walk(r'C:\Users\ll\Desktop\pandas\excel 阅读全文
posted @ 2022-01-13 22:40 程序员日记 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 一个类中函数之间变量引用,或者函数互相调用: class A: def one(self): self.a = 10 self.b = 5 return self.a, self.b def two(self): self.one() self.c = self.a + self.b print(s 阅读全文
posted @ 2021-03-06 17:07 程序员日记 阅读(503) 评论(0) 推荐(0) 编辑
摘要: 本程序的目标是根据姓名将来源表中的班级填至目标表中 来源表: 目标表 1 import pandas as pd 2 import easygui as g 3 4 # 本程序的目标是根据姓名将来源表中的班级填至目标表中 5 lj1 = g.fileopenbox(msg='请选择需要填充的exce 阅读全文
posted @ 2021-01-26 21:32 程序员日记 阅读(1451) 评论(0) 推荐(0) 编辑
摘要: 1 a = input('请输入一个数字:') 2 a1 = format(float(a), '.2f') 3 a2 = format(float(a1), ',') 4 a_len = len(a2.split('.')[1]) 5 if a_len == 1: 6 a3 = a2 + '0' 阅读全文
posted @ 2020-10-27 19:34 程序员日记 阅读(2405) 评论(0) 推荐(0) 编辑
摘要: # 循环改变列表,不要使用for 应该使用while# 定义二个列表,目标是将old_names列表的内容循环挪到new_names列表里。 old_names = ['张三', '李四', '王五'] new_names = [] # 1.错误的使用for 循环 for name in old_n 阅读全文
posted @ 2020-10-08 18:31 程序员日记 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 1 生成一个dataframe >>> import pandas as pd >>> df = pd.read_excel('students.xlsx', index_col='ID') >>> df name class ID 1 张三 一班 2 张三 二班 3 李四 二班 4 王五 一班 5 阅读全文
posted @ 2020-05-10 16:57 程序员日记 阅读(7109) 评论(0) 推荐(0) 编辑
摘要: class excleOPen(QtWidgets.QMainWindow, Ui_MainWindow): def __init__(self, parent=None, *args, **kwargs): super().__init__(parent, *args, **kwargs) sel 阅读全文
posted @ 2020-05-07 22:43 程序员日记 阅读(1123) 评论(0) 推荐(0) 编辑
摘要: 使用pycharm制作scrapy爬虫,在spider模块时引用items.py中的模块报错,即出现红色的波浪线。 原因分析: pycharm不会将当前文件目录自动加入自己的sourse_path。 解决方法: 右键make_directory as–>sources path将当前工作的文件夹加入 阅读全文
posted @ 2020-04-25 16:13 程序员日记 阅读(676) 评论(0) 推荐(0) 编辑