从具有多列的 .txt 文件中查找最大值、最小值

find max, min from a .txt-file which has multiple columns

我在 .txt 文件中有很多数据。 它看起来像这样:

#   T1  T2  T3  T4  T5  T6  T7  T8
1   20.67   20.70   20.73   20.76   20.69   20.73   20.66   20.72

2   20.68   20.70   20.74   20.75   20.69   20.73   20.66   20.72

我想找到 max/min。使用 Python 脚本的值。

首先,我试图找到 T1 列的最大值。 这是我的(非常非常简单的)代码:

import numpy as np

T1 = np.genfromtxt('data.txt', unpack=True)

T1_max=np.maximum(T1)

print("T1_max")

当我尝试 运行 它时,我收到如下错误消息:

Line #7816 (got 10 columns instead of 1)
Line #7817 (got 10 columns instead of 1)
Line #7818 (got 10 columns instead of 1)
Line #7819 (got 10 columns instead of 1)
Line #7820 (got 10 columns instead of 1)
Line #7821 (got 2 columns instead of 1)

(它从第 2 行开始(得到 10..)。 它必须是 'np.genfromtxt' 函数。我必须添加什么参数才能使其工作?或者你知道如何启动一个替代脚本来输出最大/最小值。价值观?

谁能帮帮我?

这里的问题不是设置 8 个变量。每一列一个变量。 python 中的 'max' 函数也可以完成这项工作:

T1, T2, T3, T4, T5, T6, T7, T8 = np.genfromtxt('data.txt', unpack=True)

T1max = max(T1)
print(T1max)