随笔分类 - 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
阅读全文
摘要:Check if program runs in Debug mode 用以下函数即可: def is_debug(): gettrace = getattr(sys, 'gettrace', None) if gettrace is None: return False elif gettrace
阅读全文
摘要:[Minor Bug] Pylint E1101 Module 'torch' has no 'from_numpy' member#701 For those using vscode, add to user settings "python.linting.pylintArgs": ["--e
阅读全文
摘要:https://cmdlinetips.com/2012/09/three-ways-to-write-text-to-a-file-in-python/
阅读全文
摘要: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
阅读全文
摘要:GET and POST requests using Python Python Requests库:HTTP for Humans 主要接口
阅读全文
摘要:问题: 安装包出现Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError 或者 “not a trus
阅读全文
摘要:(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
阅读全文
摘要:Python MySQLdb 循环插入execute与批量插入executemany性能分析 用Python连接MySQL数据库时,会用到MySQLdb库,这里下载↓↓↓ https://pypi.python.org/pypi/MySQL-python/ 这个库提供了对数据库的普遍操作,增删改查之
阅读全文
摘要: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
阅读全文
摘要:解决方法 在lauch.json中,修改 "env": {}为 "env": {"PYTHONPATH":"${workspaceRoot}"} 完整的代码如下:
阅读全文
摘要: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
阅读全文
摘要:最近在研究sample之间的similarity,以便更好地进行clustering,一下是相关资料 TF-IDF与余弦相似性的应用(一):自动提取关键词 TF-IDF与余弦相似性的应用(二):找出相似文章 相似度(距离计算)汇总 常用的相似度计算方法原理及实现 机器学习中的相似性度量 大量短文本聚
阅读全文
摘要:What is the fastest way to upload a big csv file in notebook to work with python pandas?
阅读全文
摘要:三种常用的方式如果在运行python脚本时需要传入一些参数,例如gpus与batch_size,可以使用如下三种方式。 python script.py 0,1,2 10python script.py -gpus=0,1,2 --batch-size=10python script.py -gpu
阅读全文
摘要:那么,如果在~/.bashrc中修改文件的话,即加入export PATH="/home/myname/anaconda2/bin:$PATH",则输入python命令就会直接出来Anaconda环境下的python,当然,用TensorFlow是好的,用caffe就。。。。。。。因此,用caffe
阅读全文
摘要:chr()、unichr()和ord() chr()函数用一个范围在range(256)内的(就是0~255)整数作参数,返回一个对应的字符。unichr()跟它一样,只不过返回的是Unicode字符,这个从Python 2.0才加入的unichr()的参数范围依赖于你的Python是如何被编译的。
阅读全文
摘要:http://benalexkeen.com/correlation-in-python/ Correlation in Python Correlation values range between -1 and 1. There are two key components of a corre
阅读全文
摘要:https://en.wikipedia.org/wiki/Sobol_sequence https://medium.com/@antoine_savine/sobol-sequence-explained-188f422b246b https://medium.com/@antoine_savi
阅读全文
摘要: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
阅读全文