相关疑难解决方法(0)

pandas可以将可变长度的空格作为列分隔符处理

我有一个文本文件,其中列由可变数量的空格分隔.是否可以直接将此文件作为pandas数据帧加载而无需预处理文件?在pandas文档中,分隔符部分说我可以使用's*'构造但我无法使其工作.

## sample data
head sample.txt

#                                                                            --- full sequence --- -------------- this domain -------------   hmm coord   ali coord   env coord
# target name        accession   tlen query name           accession   qlen   E-value  score  bias   #  of  c-Evalue  i-Evalue  score  bias  from    to  from    to  from    to  acc description of target
#------------------- ---------- ----- -------------------- ---------- ----- --------- ------ ----- --- --- --------- --------- ------ ----- ----- ----- ----- ----- ----- ----- ---- ---------------------
ABC_membrane         PF00664.18   275 AAF67494.2_AF170880 …
Run Code Online (Sandbox Code Playgroud)

python pandas

36
推荐指数
3
解决办法
2万
查看次数

标签 统计

pandas ×1

python ×1