Python Pandas : How to skip columns when reading a file?

后端 未结 2 622
暖寄归人
暖寄归人 2021-01-03 22:42

I have table formatted as follow :

foo - bar - 10 2e-5 0.0 some information
quz - baz - 4 1e-2 1 some other description in here

When I open

2条回答
  •  别那么骄傲
    2021-01-03 23:04

    The usecols parameter allows you to select which columns to use:

    a = pd.read_table("file", header=None, sep=" ", usecols=range(8))
    

    However, to accept irregular column counts you need to also use engine='python'.

提交回复
热议问题