在python中查找混合整数和字符串的无索引列的最大值



I have a data without column headers and I want to find the max and min latitude and longitude which is index[2] and index[4] followed by index[3]=N and index[5]=E.

Example of the data is as follows:

1,5,6,9n,8,4,9,0

3,66,t,87,5,8

2,s,1.23,N,1.39,E

1,2,1.45,N,1.26,E,2N,9

7,-3,5,L,67,34,K,78,6,4

我已经试过了:

with open ("E:\abcxyz.txt", "r") as file1:
Lines = file1.readlines()
data = Lines
for line in Lines:
spline = line.split(",")
l1= []
l1.append(spline[2])
print(l1)

得到一个组合列表,这样我就可以得到一个max()。但是我不知道。"结果图像如下:

['6']

['t']

['1.23']

['1.45']

['5']

任何帮助都是感激的。

谢谢大家。我终于找到了解决这个问题的办法。我使用了

pd.read_csv

和索引[2]&[4]再次感谢您

最新更新