随笔分类 -  python

摘要:代码演示 将首字母大写,其余小写 效果演示 参考链接 https://www.w3resource.com/pandas/series/series-str-title.php 阅读全文
posted @ 2022-07-06 10:18 胸怀丶若谷 阅读(117) 评论(0) 推荐(0) 编辑
摘要:解决方案 代码 效果展示 完整代码 import pandas as pd import numpy as np df = pd.DataFrame(np.arange(12).reshape(3,4), columns=['A', 'B', 'C', 'D']) print("df",df) # 阅读全文
posted @ 2022-06-22 14:06 胸怀丶若谷 阅读(1129) 评论(0) 推荐(0) 编辑
摘要:解决方案 df['w'] #选择表格中的'w'列,使用类字典属性,返回的是Series类型 df.w #选择表格中的'w'列,使用点属性,返回的是Series类型 df[['w']] #选择表格中的'w'列,返回的是DataFrame属性 data[0:2] #返回第1行到第2行的所有行,前闭后开, 阅读全文
posted @ 2022-06-22 13:49 胸怀丶若谷 阅读(3635) 评论(0) 推荐(0) 编辑
摘要:解决方案 res = df_by_monthly.set_index('recruit_resign_month').T.to_dict('list') print(res) 上述代码是转为列表形式 转为字典形式 res = df_by_monthly.set_index('recruit_resi 阅读全文
posted @ 2022-04-26 11:26 胸怀丶若谷 阅读(318) 评论(0) 推荐(0) 编辑
摘要:推荐写法 参考链接 https://blog.csdn.net/u013061183/article/details/79497254 阅读全文
posted @ 2022-04-25 17:52 胸怀丶若谷 阅读(46) 评论(0) 推荐(0) 编辑
摘要:参考示例 def test(x): return x * 2 mylist = [1, 2, 3, 4, 5] result = list(map(test, mylist)) print(result) 运行结果如下所示: [2, 4, 6, 8, 10] 参考链接 https://www.pro 阅读全文
posted @ 2022-04-23 14:17 胸怀丶若谷 阅读(48) 评论(0) 推荐(0) 编辑
摘要:获取整个字段转换成列表,并将列表转换成字典 阅读全文
posted @ 2022-02-24 08:55 胸怀丶若谷 阅读(92) 评论(0) 推荐(0) 编辑
摘要:区别 在讲is和==这两种运算符区别之前,首先要知道Python中对象包含的三个基本要素,分别是:id(身份标识)、type(数据类型)和value(值)。 == ==是python标准操作符中的比较操作符,用来比较判断两个对象的value(值)是否相等, is is也被叫做同一性运算符,这个运算符 阅读全文
posted @ 2022-02-23 11:05 胸怀丶若谷 阅读(127) 评论(0) 推荐(0) 编辑
摘要:背景 将Dataframe的每一列数据转换成字典并保存。也就是字段名变为key, 数值变为value. 方案 以下是效果图 参考链接 https://blog.csdn.net/hanyunkaka/article/details/120603027 阅读全文
posted @ 2022-01-15 19:06 胸怀丶若谷 阅读(271) 评论(0) 推荐(0) 编辑
摘要:解决方案 download_page_data_df.columns = column_name2excel 参考链接 https://www.cnblogs.com/bigtreei/p/10145123.html 阅读全文
posted @ 2022-01-15 13:37 胸怀丶若谷 阅读(460) 评论(0) 推荐(0) 编辑
摘要:安装python3.6 $ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt update $ sudo apt install python3.6 安装 sudo apt-get install virtualenvwrapper 创建文件 阅读全文
posted @ 2021-12-07 16:32 胸怀丶若谷 阅读(222) 评论(0) 推荐(0) 编辑
摘要:安装 pip install python-dateutil dateutil模块主要有两个函数,parser和rrule。 其中parser是根据字符串解析成datetime,而rrule则是根据定义的规则来生成datetime。 参考链接 https://www.jianshu.com/p/f2 阅读全文
posted @ 2021-11-15 14:26 胸怀丶若谷 阅读(86) 评论(0) 推荐(0) 编辑
摘要:函数isinstance 语法 isinstance(object, classinfo) 参数 object -- 实例对象。 classinfo -- 可以是直接或间接类名、基本类型或者由它们组成的元组。 返回值 如果对象的类型与参数二的类型(classinfo)相同则返回 True,否则返回 阅读全文
posted @ 2021-11-15 14:03 胸怀丶若谷 阅读(808) 评论(0) 推荐(0) 编辑
摘要:output_data["ShipDate"] = output_data["ShipDate"].dt.strftime("%Y/%m/%d") 阅读全文
posted @ 2021-08-23 14:09 胸怀丶若谷 阅读(267) 评论(0) 推荐(0) 编辑
摘要:输入命令: pip freeze > requirements.txt 产生的文件内容如下: asgiref==3.4.0 Django==3.2.4 django-debug-toolbar==3.2.1 django-redis==5.0.0 Pillow==8.3.0 PyMySQL==1.0 阅读全文
posted @ 2021-07-14 14:55 胸怀丶若谷 阅读(213) 评论(0) 推荐(0) 编辑
摘要:方案一(有时会失效): 将EXCEL文件中的格式全部清除即可。最好是复制,然后只粘贴值。 方案二(指定引擎): data = pd.read_excel(path, engine="openpyxl") pd.read_excel(),参数详解: (1)sheet_name: excel文件中的表名 阅读全文
posted @ 2021-05-28 14:03 胸怀丶若谷 阅读(1287) 评论(0) 推荐(0) 编辑
摘要:# 清除文本框 self.textEdit_detail.clear() # 清楚表格所有行 self.tableWidget.setRowCount(0) self.tableWidget.clearContents() # 清除进度条 self.progressBar.reset() app.p 阅读全文
posted @ 2021-04-30 12:38 胸怀丶若谷 阅读(2390) 评论(0) 推荐(0) 编辑
摘要:result = os.path.exists(self.MailSendingStatusPath) if result == True: self.append_status_report() elif result == False: self.create_new_status_report 阅读全文
posted @ 2021-04-25 20:08 胸怀丶若谷 阅读(102) 评论(0) 推荐(0) 编辑
摘要:更改数据 from playhouse.migrate import *# SQLite example: my_db = SqliteDatabase('my_database.db') migrator = SqliteMigrator(my_db)# 使用migrate()执行一个或多个操作 阅读全文
posted @ 2021-04-24 13:32 胸怀丶若谷 阅读(302) 评论(0) 推荐(0) 编辑

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