随笔分类 - Python
摘要:ubuntu环境: Ctrl Alt 斜杠 代码整理 Ctrl D 复制当前行 Ctrl Y 删除当前行 Shift + Enter 新建一行 Ctrl+Win+加号 展开函数 Ctrl+Win+减号 折叠函数 Ctrl+Shift+Win+加号 展开所有函数 Ctrl+Shift+Win+减号 折
阅读全文
摘要:image_pylib模块:https://github.com/huangshiyu13/image_pylib data_engine模块:https://github.com/huangshiyu13/RPNplus/blob/master/data_engine.py _init_paths
阅读全文
摘要:如下所示: 结果: 以MNIST为例,先做PCA降到50维,再做t-sne: 结果如下: 更多降维的可视化参考:http://scikit-learn.org/stable/auto_examples/manifold/plot_lle_digits.html#sphx-glr-auto-examp
阅读全文
摘要:itemindex = numpy.where(array==item)
阅读全文
摘要:例子: import random c = list(zip(a, b)) random.shuffle(c) a[:], b[:] = zip(*c)
阅读全文
摘要:该程序会每隔至少1秒进行一次护照状态查询 需要修改passportNo变量为自己的护照号码。 另外需要pip install beautifulsoup4
阅读全文
摘要:1.next http://www.cnblogs.com/sesshoumaru/p/6037922.html 2.getattr getattr(x, 'y') is equivalent to x.y
阅读全文
摘要:import os def fileAppend(filename): myfile = open(filename,'a') myfile.write("####&&&&") myfile.close if __name__ == '__main__': filename = 'test.rmvb' fileAppend(filename) ...
阅读全文
摘要:最近比较喜欢的一个并行实现,可以实时查看结果: from concurrent.futures import ProcessPoolExecutor, as_completed executor = ProcessPoolExecutor(max_workers=5) tasks = [execut
阅读全文
摘要:def myprint(v): print v print type(v) try: print v.shape except: try: print len(v) except: pass
阅读全文
摘要:转自:https://www.douban.com/note/518335786/?type=like 改变数组的维度 已知reshape函数可以有一维数组形成多维数组ravel函数可以展平数组b.ravel()flatten()函数也可以实现同样的功能区别:ravel只提供视图view,而flat
阅读全文
摘要:参考:http://www.guokr.com/post/317472/
阅读全文
摘要:install: official examples: https://seaborn.pydata.org/examples/index.html 在mac上的bug: 在mac上运行会出现warnings.warn("tight_layout : falling back to Agg rend
阅读全文
摘要:official document: http://pandas.pydata.org/pandas-docs/stable/10min.html 基本数据结构:http://www.open-open.com/lib/view/open1402477162868.html 绘图文档:http://
阅读全文
摘要:import os.path as osp import sys def add_path(path): if path not in sys.path: sys.path.insert(0, path) this_dir = osp.dirname(__file__) path1 = osp.join(this_dir, '..', 'DATA') add_pat...
阅读全文
摘要:import os import shutil from PIL import Image def getAllFiles(dirName, houzhui=' '): results = [] for file in os.listdir(dirName): file_path = os.path.join(dirName, file) if...
阅读全文
摘要:import numpy as np list = range(3) # 0 1 2 np.random.shuffle(list)#2 1 3,打乱了list 产生一个随机整数:
阅读全文