长虫山小木屋

没有谁会为你踏雪而来 喜欢的风景要躬亲筚路

  博客园  :: 首页  :: 新随笔  :: 联系 ::  :: 管理
  115 随笔 :: 0 文章 :: 6 评论 :: 90332 阅读

随笔分类 -  python

摘要:读取写入千万级别的excel文件费时费力,调试起来比较慢,面对这个问题,第一步可以先无脑全部转换成pkl文件,这样几乎和内存操作一样的速度。 例如: t=pd.read_excel("12月.xlsx",sheet_name=None) excel全表读入,然后无脑写入硬盘: import pick 阅读全文
posted @ 2024-10-11 10:26 长虫山小木屋 阅读(100) 评论(0) 推荐(0) 编辑

摘要:html <a draggable="false">禁止拖拽</a> css .nowrap{word-break:keep-all;white-space:nowrap;}/*不换行*/.box{box-sizing:border-box;}/*CSS容器宽度不受padding、border影响* 阅读全文
posted @ 2024-04-09 08:43 长虫山小木屋 阅读(6) 评论(0) 推荐(0) 编辑

摘要:#检查库安装的目录import os import numpy as np import pandas as pd print(os.path.dirname(np.__file__)) print(os.path.dirname(pd.__file__)) #pip指定安装目录 #pip inst 阅读全文
posted @ 2024-03-01 10:11 长虫山小木屋 阅读(69) 评论(0) 推荐(0) 编辑

摘要:问题:自己通过命令行执行python正常,但通过php调用就没有反应。解决方法:1、首先检查一下php有没有执行权限,简单粗暴的:sudo chmod 777 xxx.php2、Python如果有中文返回,似乎需要额外操作。可以先去掉中文排除掉其他原因,也可以尝试以下操作:在python文件头部加上 阅读全文
posted @ 2023-07-15 17:19 长虫山小木屋 阅读(94) 评论(0) 推荐(0) 编辑

摘要:wkhtmltox的下载地址:https://wkhtmltopdf.org/downloads.html 或者:https://github.com/wkhtmltopdf/wkhtmltopdf 0.12.6版本按网络上的教程会出现一个错误: IOError: wkhtmltopdf exite 阅读全文
posted @ 2023-04-21 17:13 长虫山小木屋 阅读(479) 评论(0) 推荐(0) 编辑

摘要:pip install python-pptx 安装好pptx,设置标题最大的作用是ppt里面的摘要视图显示摘要文字 参考:https://python-pptx.readthedocs.io/en/latest/ from pptx import Presentation from pptx.ut 阅读全文
posted @ 2023-04-20 15:27 长虫山小木屋 阅读(171) 评论(0) 推荐(0) 编辑

摘要:错误信息:ValueError: unsupported format character ‘Y’ (0x59) at index 70产生原因:因为python执行的sql中存在类似DATE_FORMAT(MAX(CREATE_TIME), ‘%Y-%m-%d’) 的写法,其中%Y与python的 阅读全文
posted @ 2021-07-08 17:17 长虫山小木屋 阅读(475) 评论(0) 推荐(0) 编辑

摘要:网上说,先执行,再打包 chcp 65001 试过没有用。 解决方案: 把import的包批量注释,然后寻找是import那个文件导致。 虽然注释会导致程序运行出错,但是打包才不管你能不能运行。 最后检查到某个文件导致,在文件第一行加入: # !/usr/bin/python # -*- codin 阅读全文
posted @ 2021-05-20 14:53 长虫山小木屋 阅读(515) 评论(1) 推荐(0) 编辑

摘要:from tkinter import * root = Tk() name = StringVar() check_box_list = [] ent=Entry(root,textvariable=name).pack() def clear(): for i in check_box_list 阅读全文
posted @ 2021-05-14 12:03 长虫山小木屋 阅读(556) 评论(0) 推荐(0) 编辑

摘要:import time scale=100 print("执行开始".center(scale+28,'-')) start = time.perf_counter() for i in range(scale+1): a = '*' * i b = '.' * (scale - i) c = (i 阅读全文
posted @ 2021-05-12 23:40 长虫山小木屋 阅读(140) 评论(0) 推荐(0) 编辑

摘要:import xlwings as xw tfile="test.xlsx" newfile="new.xlsx" app = xw.App(visible=False, add_book=False) app.display_alerts = False app.screen_updating = 阅读全文
posted @ 2021-04-30 11:35 长虫山小木屋 阅读(120) 评论(0) 推荐(0) 编辑

摘要:continue表示跳过后面的程序,重新循环,而pass表示站位,什么也不做,后面的代码(else之前)还是会执行, a = 'python' i = 2 for element in a: if element == 'y': pass i = 3 else: print(element+str( 阅读全文
posted @ 2021-04-30 10:00 长虫山小木屋 阅读(671) 评论(0) 推荐(0) 编辑

摘要:def readf(file): t0 = time.time() data=pd.read_csv(file,low_memory=False,encoding='gbk' #,nrows=100 ) t1 = time.time() print('耗时%0.3f秒钟'%(t1-t0)) retu 阅读全文
posted @ 2021-04-09 14:42 长虫山小木屋 阅读(395) 评论(0) 推荐(0) 编辑

摘要:python的gui太难用了,唯一能配置独立前端的程序只有web。所以用web做前端,到python,完美! 环境准备 Python 3.9 Chrome浏览器(由于Eel是直接调用的Chrome的app启动模式,所以自己很轻量,不过需要提前安装有Chrome) 安装Eel库 pip install 阅读全文
posted @ 2021-03-29 15:21 长虫山小木屋 阅读(3103) 评论(0) 推荐(0) 编辑

摘要:为什么不用:pd.read_excel ? 因为 pd 使用 openpyxl 读取excel文件,有时候xlsx文件是由ApachIO产生的读取进去会出错,换个方式,用xlwings(基于pywin32,会调用系统自带的excel软件读取)。 传说会更快吗,没有测试速度,可以自行测试。 代码: i 阅读全文
posted @ 2021-02-24 12:30 长虫山小木屋 阅读(1458) 评论(0) 推荐(0) 编辑

摘要:常见库简介 xlrd xlrd是一个从Excel文件读取数据和格式化信息的库,支持.xls以及.xlsx文件。http://xlrd.readthedocs.io/en/latest/1、xlrd支持.xls,.xlsx文件的读2、通过设置on_demand变量使open_workbook()函数只 阅读全文
posted @ 2021-02-24 11:30 长虫山小木屋 阅读(330) 评论(0) 推荐(0) 编辑

摘要:x=" asdf ada都 是 年 费 sdf sf " print("".join(x.split())) 测试全角半角空格都没有了 阅读全文
posted @ 2020-12-23 11:21 长虫山小木屋 阅读(414) 评论(0) 推荐(0) 编辑

摘要:实际中遇到需要这样来猜测 import itertools import math abc=22.8#10.8,22,10 list_abc=[ 1.82,0.82,1.6,7.41,4.94,7.6,21.97,82.14,25.8,45.89,20.09, 16.81,0.08,0.02,1.6 阅读全文
posted @ 2020-11-10 09:52 长虫山小木屋 阅读(505) 评论(0) 推荐(0) 编辑

摘要:# -*- coding: UTF-8 -*-import pandas as pdimport numpy as npimport datetimeimport osimport sysimport warningswarnings.filterwarnings('ignore')#忽略warni 阅读全文
posted @ 2020-10-29 14:37 长虫山小木屋 阅读(966) 评论(0) 推荐(0) 编辑

摘要:根据数据的不同情况及处理数据的不同需求,通常会分为两种情况,一种是去除完全重复的行数据,另一种是去除某几列重复的行数据,就这两种情况可用下面的代码进行处理。 1. 去除完全重复的行数据 data.drop_duplicates(inplace=True) 2. 去除某几列重复的行数据 data.dr 阅读全文
posted @ 2020-10-10 10:20 长虫山小木屋 阅读(1300) 评论(0) 推荐(0) 编辑

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