
使用pandas读取csv文件,数据不对齐问题
使用pandas读取csv文件,在一定参数下,第一行错位俩列,如何才能使其对其
想要 第一行的A 在 M的上方 ,R 在-2的上方,如何实现
import pandas as pd
f = pd.read_csv('ckm1.ascii_pssm.2',header=1,delim_whitespace=True,skipfooter=6,usecols=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])
df = pd.DataFrame(f)
这是读取参数的代码
#python
0 提建议
当前问题酬金
¥ 0 (可追加 ¥500)
支付方式
扫码支付
1 条回答 默认 最新
-
关注
index_col : int or sequence or False, default None Column to use as the row labels of the DataFrame. If a sequence is given, a MultiIndex is used. If you have a malformed file with delimiters at the end of each line, you might consider index_col=False to force pandas to not use the first column as the index (row names)
index_col=False 使得pandas不用第一列做索引(行名)
加这个参数试试:index_col=False
本回答被题主选为最佳回答 , 对您是否有帮助呢? 本回答被专家选为最佳回答 , 对您是否有帮助呢? 本回答被题主和专家选为最佳回答 , 对您是否有帮助呢?举报按下Enter换行,Ctrl+Enter发表内容