python-3.x - 从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:\\abc\xyz.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
以及 index[2] & [4] 的 max() 再次感谢
推荐阅读
- string - 在 Postgresql 中的字符串中排序逗号分隔值
- dataframe - 使用 XLSX.gettable 读取非连续列?
- c++ - SFINAE - 如果参数是可复制构造的,则启用一个函数,否则启用另一个函数
- java - 遍历map的时候顺序是怎么决定的
- c# - 在 C# 中获得奇怪的价值
- javascript - jsPDF:将创建的 pdf 直接打印到打印机设备
- java - 第一个控制器中第二个控制器的访问方法和标签
- python - 如何确定图像是主要是黑色还是主要是白色
- javascript - React-select multi select 在未选择任何值时更新道具
- python - Python API 错误 - 'faultstring': 'JSONThreatProtection