
python
随时学丫
越努力越幸运
展开
-
正则将段落分割成句子
python 正则分割段落为单个句子,三种分割情况,直接用原创 2024-05-06 17:36:06 · 445 阅读 · 2 评论 -
langchain安装环境错误汇总
langchain安装错误汇总原创 2023-06-20 16:30:52 · 4890 阅读 · 0 评论 -
pandas写入excel报错 ‘Workbook‘ object has no attribute ‘sheetnames‘
我在jupyter notebook同样的代码能正常写入excel并成功写入图片,但在pycharm老是报错,我核对了虚拟环境和pandas的包,确定是在同一个虚拟环境,pandas的包都是一样的,但就是一直报错,为此我查了几个小时,一晚上都没解决,周一来上班,我又继续尝试,没想到一个小时我就解决了,居然只需要加一个参数。原创 2023-03-27 11:04:00 · 2907 阅读 · 0 评论 -
自定义CountVectorizer,计算idf
快速计算idf原创 2023-02-24 10:48:37 · 200 阅读 · 0 评论 -
datetime计算时间差(小时)
因为datetime计算时间差,只有 seconds, days,没有hours,于是,我就利用 seconds / 3600,来计算hours,但是出现了错误的结果(new_time - old_time).seconds(new_time - old_time).daysdatetime计算hours案例from datetime import datetimedef calc_hours(old): old_time = datetime.strptime(old, "%Y-%m-原创 2020-11-21 22:58:01 · 8636 阅读 · 1 评论 -
安装pyHive报错
安装pyhive还需要安装其他依赖包pip install saslpip install thriftpip install thrift-saslpip install PyHive安装sasl遇到的问题Collecting sasl Using cached https://files.pythonhosted.org/packages/8e/2c/45dae93d666aea8492678499e0999269b4e55f1829b1e4de5b8204706ad9/sasl-0.原创 2020-11-10 11:08:59 · 992 阅读 · 0 评论 -
Redis 工具类
Redis 工具类实现的功能包括 redis 读取队列数据,存储和读取 hash 数据,Redis 的创建,RedisCluster 的创建import sysimport redisfrom rediscluster import RedisClusteris_redis_cluster = Trueclass RedisObj(object): def __init__(s...原创 2019-12-14 15:53:31 · 194 阅读 · 0 评论 -
japronto 安装教程
japronto 安装教程官方文档python3 -m pip install japronto报错如下Collecting japronto Could not find a version that satisfies the requirement japronto (from versions: )No matching distribution found for jap...原创 2019-12-13 21:33:49 · 1029 阅读 · 0 评论 -
Redis 连接编码问题
Redis 连接编码问题不编码情况下,UnicodeDecodeErrorTraceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/python3/lib/python3.4/site-packages/redis/client.py", lin...原创 2019-11-23 15:23:47 · 2068 阅读 · 0 评论 -
Redis cluster 连接 (python)
Redis cluster 连接 (python)安装pip install redis-py-cluster官方 Demo>>> from rediscluster import RedisCluster>>> # Requires at least one node for cluster discovery. Multiple nodes i...原创 2019-11-23 12:02:09 · 2656 阅读 · 0 评论