随笔分类 -  python

摘要:相当于None https://blog.csdn.net/lanchunhui/article/details/49725065 阅读全文
posted @ 2018-06-23 11:00 Apollo_zhanghongbo 阅读(453) 评论(0) 推荐(0)
摘要:本地电脑是win10系统,用本地的pycharm,ssh连接到服务器。最近需用matplotlib画一些图,于是试着配置了一下。 主要需要配置x11 forwarding, Xming, 配置ssh支持X11 farwarding 开启Xming服务 给pycharm配置DISPLAY变量,这一步不 阅读全文
posted @ 2018-06-22 21:36 Apollo_zhanghongbo 阅读(3101) 评论(1) 推荐(0)
摘要:当在文本文件中,空值为null,读入dataframe中,空值为NaN时,使用pd.isnull()\pd.notnull()对一列进行空值判断; 参考:https://blog.csdn.net/xidianliutingting/article/details/62041891 阅读全文
posted @ 2018-06-19 17:49 Apollo_zhanghongbo 阅读(8634) 评论(0) 推荐(0)
摘要:参考:http://www.runoob.com/python/att-string-format.html https://www.hackerrank.com/challenges/py-set-mutations/problem?h_r=next-challenge&h_v=zen 阅读全文
posted @ 2018-06-19 14:41 Apollo_zhanghongbo 阅读(215) 评论(0) 推荐(0)
摘要:*args是可变长参数,在函数内部以tuple形式存储; >>> fun_var_args(1, 'two', 3)arg: 1<type 'tuple'> >>>fun_var_args(1, "two",3) arg: 1another arg: twoanother arg: 3 对于参数** 阅读全文
posted @ 2018-06-12 14:42 Apollo_zhanghongbo 阅读(259) 评论(0) 推荐(0)
摘要:Counter可以用来统计list中有哪些元素,每个出现多少次; defaultdict中指定value的类型后,比如指定为int,则对于没有出现过的key,其value为0,而不是报错;(value类型还能指定为list,则没出现过的key,其value为[]); OrderedDict中可以进行 阅读全文
posted @ 2018-06-12 14:27 Apollo_zhanghongbo 阅读(250) 评论(0) 推荐(0)
摘要:https://github.com/eagleon/eagleon.github.com/issues/2 阅读全文
posted @ 2018-06-11 21:08 Apollo_zhanghongbo 阅读(2742) 评论(0) 推荐(0)
摘要:格式 描述%% 百分号标记 #就是输出一个%%c 字符及其ASCII码%s 字符串%d 有符号整数(十进制)%u 无符号整数(十进制)%o 无符号整数(八进制)%x 无符号整数(十六进制)%X 无符号整数(十六进制大写字符)%e 浮点数字(科学计数法)%E 浮点数字(科学计数法,用E代替e)%f 浮 阅读全文
posted @ 2018-05-18 19:23 Apollo_zhanghongbo 阅读(357) 评论(0) 推荐(0)
摘要:from scipy import sparse sparse.save_npz('./filename.npz', csr_matrix_variable) #保存 csr_matrix_variable = sparse.load_npz('path.npz') #读 参考: https://b 阅读全文
posted @ 2018-05-18 19:22 Apollo_zhanghongbo 阅读(4514) 评论(0) 推荐(1)
摘要:用pickle保存中间变量: with open('path/file_name.pickle', 'wb') as handle: pickle.dump(variable_name, handle, protocol=2) 用pickle读取中间变量: with open('path/file_ 阅读全文
posted @ 2018-05-18 19:21 Apollo_zhanghongbo 阅读(1373) 评论(0) 推荐(0)
摘要:https://stackoverflow.com/questions/11707586/python-pandas-how-to-widen-output-display-to-see-more-columns 阅读全文
posted @ 2018-04-18 21:01 Apollo_zhanghongbo 阅读(2390) 评论(0) 推荐(0)
摘要:num_col = 0; with open('xxx/xxx.xxx','rb') as fi: while(fi.readline() !=''): num_col = num_col + 1; 阅读全文
posted @ 2018-04-18 15:17 Apollo_zhanghongbo 阅读(2263) 评论(0) 推荐(0)
摘要:https://blog.csdn.net/pipixiu/article/details/78628823 阅读全文
posted @ 2018-04-14 16:56 Apollo_zhanghongbo 阅读(1243) 评论(0) 推荐(0)
摘要:https://blog.csdn.net/a19990412/article/details/79304944 求DataFrame的协方差矩阵 df.corr() 阅读全文
posted @ 2018-04-14 03:16 Apollo_zhanghongbo 阅读(479) 评论(0) 推荐(0)
摘要:检验同一个热点,同一个采样点,同一个channel的csi值(500个)是否符合正太分布,或者符合其他什么分布? 采用Q-Q图。 参考资料:https://wenku.baidu.com/view/c661ebb365ce050876321319.html 用QQ图检验一序列是否服从正太分布,序列为 阅读全文
posted @ 2018-04-07 14:46 Apollo_zhanghongbo 阅读(919) 评论(0) 推荐(0)
摘要:避免对大文件全部读取到内存中,浪费时间,也能避免内存溢出;先对文件先进行抽样,抽出很小一部分,测试程序的语法正确性,再用全部文件测试程序的功能正确性; num_sample = 10;with open("data/clean_data/normalized_training.csv", "rb") 阅读全文
posted @ 2018-04-05 14:56 Apollo_zhanghongbo 阅读(351) 评论(0) 推荐(0)
摘要:官方参考文档:https://www.tensorflow.org/api_docs/python/tf/nn/conv1d 参考网页: http://www.riptutorial.com/tensorflow/example/19385/basic-example http://www.ript 阅读全文
posted @ 2018-04-03 20:31 Apollo_zhanghongbo 阅读(909) 评论(0) 推荐(0)
摘要:print在python2中是关键字,在Python3中是函数 dict在python2中有has_key()方法,在python3中没有这个方法,用key in dict_name判断键是否在字典中 阅读全文
posted @ 2018-04-02 20:00 Apollo_zhanghongbo 阅读(154) 评论(0) 推荐(0)
摘要:https://www.jianshu.com/p/db8ca931026a import tensorflow as tf import numpy as np def get_weights(shape, lambd): var = tf.Variable(tf.random_normal(sh 阅读全文
posted @ 2018-04-02 16:07 Apollo_zhanghongbo 阅读(479) 评论(0) 推荐(0)
摘要:出错代码:data = pd.read_csv(fname); 原因:byte 0xcb不能被解码成utf-8编码; 解决方法:指定使用gbk编码 data = pd.read_csv(fname, encoding='gbk'); 阅读全文
posted @ 2018-04-01 22:05 Apollo_zhanghongbo 阅读(401) 评论(0) 推荐(0)