科学网

 找回密码
  注册
pandas 将 行号(index索引号)转化为新的列
高建召 2020-5-5 23:30
pandas 将 行号(index索引号)转化为新的列 参考: https://stackoverflow.com/questions/20461165/how-to-convert-index-of-a-pandas-dataframe-into-a-column import pandas as pd 如果是多个索引列,使用 df.reset_index(level= ) 如果是单个索引值 df =df.index
个人分类: python|11644 次阅读|没有评论
numpy 产生重复的数、一维向量。
高建召 2020-5-5 23:12
numpy 产生重复的数、一维向量。 主要使用 numpy.repeat() numpy.tile() 函数 import numpy as np np.repeat(3,5) # 产生5个3 。 a2= np.tile(a2,(5,1)) # 按照行方向重复一维数组 np.tile(a2,(1,5)) # 安装列方向重复一维数组 np.tile(a2,(2,2)) # 产生2*2 个 ...
个人分类: python|5096 次阅读|没有评论
Pandas 索引项 问题 (行号)
高建召 2020-4-28 14:12
import pandas as pd (1)Pandas 遇到 cannot handle a non-unique multi-index 可能是因为索引项不唯一造成的,去掉重复的索引即可。 (2)pandas dataframe 去掉重复的行 参考 https://stackoverflow.com/questions/13035764/remove-rows-with-duplicate-indices-pandas-da ...
个人分类: python|6280 次阅读|没有评论
Biopython 从蛋白质结构得到序列
高建召 2020-3-22 19:54
中文教程网站: https://biopython-cn.readthedocs.io/zh_CN/latest/index.html 从PDB文件中获取 蛋白质序列有以下两种形式: 1.一种以C-N 模式; 2. 一种是CA-CA模式。 from Bio import PDB #UsingC-N ppb= PDB.PPBuilder() forppinppb.build_peptides(structure): ...
个人分类: python|4604 次阅读|没有评论
Anaconda 添加清华源
高建召 2020-3-15 09:12
Anaconda添加清华源 condaconfig--addchannelshttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ condaconfig--addchannelshttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ condaconfig--setshow_channel_urlsye ...
个人分类: python|6476 次阅读|没有评论
Ubuntu 修改python3为默认的python
高建召 2019-12-29 21:26
参考: https://jingyan.baidu.com/article/7082dc1cd8139ee40a89bdb5.html 设python3 为默认的python sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
个人分类: python|2306 次阅读|没有评论
numpy 数组连接
高建召 2019-12-6 15:40
垂直组合 np.vstack(( a, b )) np.concatenate(( a , b ),axis=0) , , , ] 水平 np.hstack(( a , b )) np.concatenate(( a , b ),axis=1) , ]
个人分类: python|1933 次阅读|没有评论
numpy 中的 nan
高建召 2019-4-26 18:50
参考: https://blog.csdn.net/u010158659/article/details/50814706 判断这些nan import numpy as np np.isinf np.isneginf np.isposinf np.isnan np.isfinite 将nan转化为数字 np.nan_to_num(a)
个人分类: python|2783 次阅读|没有评论
numpy 中的 nan
高建召 2019-4-26 18:48
参考: https://blog.csdn.net/u010158659/article/details/50814706 判断这些nan import numpy as np np.isinf np.isneginf np.isposinf np.isnan np.isfinite 将nan转化为数字 np.nan_to_num(a)
个人分类: python|2192 次阅读|没有评论

本页有 1 篇博文因作者的隐私设置或未通过审核而隐藏

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-19 07:22

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部