随笔分类 -  Python

摘要:How to select rows from a DataFrame based on column values ... o select rows whose column value equals a scalar, some_value, use ==: df.loc[df['column 阅读全文
posted @ 2019-12-05 15:22 andy_0212 阅读(595) 评论(0) 推荐(0) 编辑
摘要:Check if program runs in Debug mode 用以下函数即可: def is_debug(): gettrace = getattr(sys, 'gettrace', None) if gettrace is None: return False elif gettrace 阅读全文
posted @ 2019-11-21 15:02 andy_0212 阅读(691) 评论(0) 推荐(0) 编辑
摘要:[Minor Bug] Pylint E1101 Module 'torch' has no 'from_numpy' member#701 For those using vscode, add to user settings "python.linting.pylintArgs": ["--e 阅读全文
posted @ 2019-11-07 14:27 andy_0212 阅读(928) 评论(1) 推荐(0) 编辑
摘要:https://cmdlinetips.com/2012/09/three-ways-to-write-text-to-a-file-in-python/ 阅读全文
posted @ 2019-10-18 15:16 andy_0212 阅读(163) 评论(0) 推荐(0) 编辑
摘要:Often you want to sort Pandas data frame in a specific way. Typically, one may want to sort pandas data frame based on the values of one or more colum 阅读全文
posted @ 2019-09-03 09:00 andy_0212 阅读(217) 评论(0) 推荐(0) 编辑
摘要:GET and POST requests using Python Python Requests库:HTTP for Humans 主要接口 阅读全文
posted @ 2019-07-16 18:00 andy_0212 阅读(139) 评论(0) 推荐(0) 编辑
摘要:问题: 安装包出现Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError 或者 “not a trus 阅读全文
posted @ 2019-07-12 15:05 andy_0212 阅读(1121) 评论(0) 推荐(0) 编辑
摘要:(Or simply conda update -n base -c defaults conda-build) If this doesn't fix, try rolling back to before your update to 4.7.5, as @LeninGF suggests, t 阅读全文
posted @ 2019-07-12 14:32 andy_0212 阅读(284) 评论(0) 推荐(0) 编辑
摘要:Python MySQLdb 循环插入execute与批量插入executemany性能分析 用Python连接MySQL数据库时,会用到MySQLdb库,这里下载↓↓↓ https://pypi.python.org/pypi/MySQL-python/ 这个库提供了对数据库的普遍操作,增删改查之 阅读全文
posted @ 2019-07-09 17:24 andy_0212 阅读(1980) 评论(0) 推荐(0) 编辑
摘要:Python 3 Quick Tip: The easy way to deal with file paths on Windows, Mac and Linux One of programming’s little annoyances is that Microsoft Windows us 阅读全文
posted @ 2019-07-09 17:23 andy_0212 阅读(222) 评论(0) 推荐(0) 编辑
摘要:解决方法 在lauch.json中,修改 "env": {}为 "env": {"PYTHONPATH":"${workspaceRoot}"} 完整的代码如下: 阅读全文
posted @ 2019-07-01 14:57 andy_0212 阅读(2665) 评论(1) 推荐(0) 编辑
摘要:file_names = fnmatch.filter(os.listdir(folder), '*.jpeg') # take care of folder sequence, 1.jpeg, 2.jpeg, 3.jpeg coll.sort(key=lambda x:int(x[:-5])) o 阅读全文
posted @ 2019-06-18 16:13 andy_0212 阅读(372) 评论(0) 推荐(0) 编辑
摘要:最近在研究sample之间的similarity,以便更好地进行clustering,一下是相关资料 TF-IDF与余弦相似性的应用(一):自动提取关键词 TF-IDF与余弦相似性的应用(二):找出相似文章 相似度(距离计算)汇总 常用的相似度计算方法原理及实现 机器学习中的相似性度量 大量短文本聚 阅读全文
posted @ 2019-06-11 10:38 andy_0212 阅读(782) 评论(0) 推荐(0) 编辑
摘要:What is the fastest way to upload a big csv file in notebook to work with python pandas? 阅读全文
posted @ 2019-06-05 15:38 andy_0212 阅读(520) 评论(0) 推荐(0) 编辑
摘要:三种常用的方式如果在运行python脚本时需要传入一些参数,例如gpus与batch_size,可以使用如下三种方式。 python script.py 0,1,2 10python script.py -gpus=0,1,2 --batch-size=10python script.py -gpu 阅读全文
posted @ 2019-05-08 17:04 andy_0212 阅读(986) 评论(0) 推荐(0) 编辑
摘要:那么,如果在~/.bashrc中修改文件的话,即加入export PATH="/home/myname/anaconda2/bin:$PATH",则输入python命令就会直接出来Anaconda环境下的python,当然,用TensorFlow是好的,用caffe就。。。。。。。因此,用caffe 阅读全文
posted @ 2019-05-08 15:55 andy_0212 阅读(3160) 评论(0) 推荐(0) 编辑
摘要:chr()、unichr()和ord() chr()函数用一个范围在range(256)内的(就是0~255)整数作参数,返回一个对应的字符。unichr()跟它一样,只不过返回的是Unicode字符,这个从Python 2.0才加入的unichr()的参数范围依赖于你的Python是如何被编译的。 阅读全文
posted @ 2019-03-25 09:53 andy_0212 阅读(230) 评论(0) 推荐(0) 编辑
摘要:http://benalexkeen.com/correlation-in-python/ Correlation in Python Correlation values range between -1 and 1. There are two key components of a corre 阅读全文
posted @ 2019-03-19 15:21 andy_0212 阅读(572) 评论(0) 推荐(0) 编辑
摘要:https://en.wikipedia.org/wiki/Sobol_sequence https://medium.com/@antoine_savine/sobol-sequence-explained-188f422b246b https://medium.com/@antoine_savi 阅读全文
posted @ 2019-03-19 14:20 andy_0212 阅读(432) 评论(0) 推荐(0) 编辑
摘要:1、产生n个全为1的数组a=[1]*n2、字符数字转化int('12')float('12.5')str(123.45)ASCII码转为相应的字符:chr(97)字符转化为相应的ASCII码:ord('a')3、三元运算b = 100a = 10 if b>0 else 5 #a = 10a = 1 阅读全文
posted @ 2019-03-14 09:06 andy_0212 阅读(5153) 评论(0) 推荐(0) 编辑