随笔分类 -  data science

摘要:当在文本文件中,空值为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)
摘要:开头几行:head 结尾几行:tail 中间几行:sed 1. 如果你只想看文件的前100行,可以使用head命令,如 head -100 filename 2. 如果你想查看文件的后100行,可以使用tail命令,如: tail -100 filename 或 tail -n 100 filena 阅读全文
posted @ 2018-06-19 10:42 Apollo_zhanghongbo 阅读(1456) 评论(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)
摘要:格式 描述%% 百分号标记 #就是输出一个%%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)
摘要: 阅读全文
posted @ 2018-04-09 20:58 Apollo_zhanghongbo 阅读(283) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2018-04-07 22:16 Apollo_zhanghongbo 阅读(764) 评论(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)
摘要:前面找到了tensorflow的一维卷积、池化函数,但是官方API太简单,网上的例子也不多。 由于没时间研究源码,只能另寻他法了。 后面细细想来,tensorflow的二维卷积、池化函数,好像也能进行一维卷积、池化;也就是,利用对图像矩阵进行卷积、池化的函数,把第一个维度设置成1。 这样做确实可行, 阅读全文
posted @ 2018-04-05 10:40 Apollo_zhanghongbo 阅读(1563) 评论(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)
摘要:https://www.tensorflow.org/api_docs/python/tf/constant 阅读全文
posted @ 2018-03-30 23:15 Apollo_zhanghongbo 阅读(617) 评论(0) 推荐(0)
摘要:https://stackoverflow.com/questions/42286972/converting-from-pandas-dataframe-to-tensorflow-tensor-object 阅读全文
posted @ 2018-03-30 23:04 Apollo_zhanghongbo 阅读(1956) 评论(0) 推荐(0)
摘要:https://blog.csdn.net/qq_22238533/article/details/70917102 阅读全文
posted @ 2018-03-30 23:01 Apollo_zhanghongbo 阅读(2110) 评论(0) 推荐(0)