简体   繁体   English

将标头放入数组,python

[英]putting headers into an array, python

I have a set of data that is below some metadata. 我有一些元数据下面的数据集。 I'm looking to put the headers into a numpy array to be used later. 我正在寻找将标头放入numpy数组中,以备后用。 However the first header needs to be ignored as that is the x data header, then the other columns are the y headers. 但是,第一个标头需要忽略,因为它是x数据标头,然后其他列是y标头。 How do i read this? 我该怎么读?

Assuming I have understood what you mean by headers (it would be easier to tell with a few complete lines, even if you had to scale it down from your actual file)... 假设我已经理解标题的含义(即使必须从实际文件中按比例缩小标题,也可以用几行完整的行来告诉它)。

I would first read the irregular lines with normal python then, on the regular lines, use genfromtxt with skip_header and usecols (make a tuple like (i for i in range(2,102)) 我将首先使用普通的python阅读不规则的行,然后在常规的行上,将genfromtxt与skip_header和usecols一起使用(创建一个元组,例如(i代表range(2,102)中的i))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM