07 2022 档案

摘要:删除python DataFrame 最后一行, all_data.drop(all_data.tail(1).index,inplace=True) 或者 all_data.drop([len(all_data)-1],inplace=True)删除最后n行 all_data.drop(all_d 阅读全文
posted @ 2022-07-22 17:02 司徒韵然 阅读(6493) 评论(0) 推荐(0) 编辑
摘要:选中多行代码,按Ctrl + / 再按一次Ctrl + /,取消注释 阅读全文
posted @ 2022-07-18 11:11 司徒韵然 阅读(860) 评论(0) 推荐(0) 编辑
摘要:使用.json作为后缀名的配置文件,在python中读取,如下 datafile.json文件: { "name" : "szeto", "password" : "abc123", "hobby" : ["drawing","running","study"] } python代码: 1 impo 阅读全文
posted @ 2022-07-17 19:25 司徒韵然 阅读(660) 评论(0) 推荐(0) 编辑
摘要:excel是常用的处理数据的工具,那么怎样把python中的pandas库中DataFrame格式的数据保存到excel表格呢?代码如下。 1 import pandas as pd 2 df1=pd.DataFrame({'Data1':[1,2,3,4,5]}) 3 df2=pd.DataFra 阅读全文
posted @ 2022-07-17 18:59 司徒韵然 阅读(3103) 评论(0) 推荐(0) 编辑
摘要:python calendar库monthrange函数可以返回指定月份的最后一天 1 import calendar 2 lastDay = calendar.monthrange(2022,2)[1] 3 #返回28 4 lastDay2 = calendar.monthrange(2024,2 阅读全文
posted @ 2022-07-17 18:44 司徒韵然 阅读(723) 评论(0) 推荐(0) 编辑

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