gpt4 book ai didi

numpy - 跳过 genfromtxt 中的行

转载 作者:行者123 更新时间:2023-12-05 01:08:39 24 4
gpt4 key购买 nike

我有下表:

 2M00251602+5422547            7.180          9.000          2.200
#2M00255540+5749320 4.420 5.200 1.600
2M00274401+5330504 4.400 6.800 2.700
2M00331747+6327504 4.540 5.900 0.400
#2M00333033+7054422 4.350 6.700 0.700
2M00350487+5953079 5.310 7.400 1.100

我想跳过带有主题标签的行。如何要求 genfromtxt 跳过具有主题标签符号的行?

注意:主题标签不需要在那里。我只需要跳过用户指定的行。

我知道在 IDL 下的 READCOL 可以做 SKIPSTRING='#'。 genfromtxt 中有类似的东西吗?如果没有,我可以使用什么程序/包来读取这样的表并跳过用户指定的行?

提前致谢!

最佳答案

使用 np.genfromtxtcomments='#'范围。

从文档:

comments : str, optional
The character used to indicate the start of a comment.
All the characters occurring on a line after a comment are discarded

关于numpy - 跳过 genfromtxt 中的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16874530/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com