numpy.loadtxt Skipping multiple rows

前端 未结 2 1099
伪装坚强ぢ
伪装坚强ぢ 2021-01-07 03:27

I believe the title of this thread explains what I am looking for. I am curious to know what the syntax is for skipping multiple rows; I can\'t seem to find such information

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-07 04:01

    If you already know the row numbers you wish to skip, then you can also use:

    import numpy as np
    InputFile = './Filename.txt'
    Dataset = np.loadtxt(InputFile, skiprows= 0 + 1 + 2 + 3 + 4 + 5)
    print(Dataset)
    

    This will skip the first five rows and print the remaining data.

提交回复
热议问题