Использование панд
import pandas as pd
# Files to read
files = ['f1.csv', 'f2.csv']
# Read each file and create a dataframe
# df[0] contains a dataframe for f1
# df[1] contains a dataframe for f2
df = []
for file in files:
df.append(pd.read_csv(file, sep='\\s+', header=None))
print(f'Dataframe of f1\n{df[0]}\n')
print(f'Dataframe of f2\n{df[1]}\n')
# Get the number of rows from df[0]
# df[1] must be of the same dimension (rows x columns)
nrows = df[0].shape[0]
ncols = df[0].shape[1]
for row in range(nrows):
print(f'\nrow {row}')
for col in range(ncols):
print(f'col {col} of f1 and f2')
col_f1 = df[0].iloc[row, col].split(',')
col_f2 = df[1].iloc[row, col].split(',')
print(f'{col_f1}, {col_f2}')
# Here you have (3586,02124;843,19598)....
# In this format: col_f1, col_f2 = [3586, 02124], [843, 19598]...
# Don't forget to convert to float() the numbers
# Ex. pt_x = float(col_f1[0])
Какие выходы:
Dataframe of f1
0 1 2 3 4
0 3586,02124 2391,50342 837,45227 -837,29681 -2385,9751
1 3587,69238 2387,48218 836,604 -840,75067 -2390,17529
2 3588,44531 2387,44556 836,00555 -840,79022 -2389,77612
3 3588,08203 2388,25439 836,26544 -840,17017 -2389,07544
4 3587,66553 2389,05566 836,53046 -839,53912 -2388,40405
Dataframe of f2
0 1 2 3 4
0 843,19598 2396,10278 3579,1377 4210,15674 4209,37549
1 841,9397 2397,21948 3573,11963 4205,89209 4226,73926
2 842,01642 2397,72266 3573,06494 4202,88379 4226,93799
3 842,22083 2397,47974 3574,27515 4204,19043 4223,8208
4 842,42065 2397,20142 3575,47437 4205,52246 4220,64795
row 0
col 0 of f1 and f2
['3586', '02124'], ['843', '19598']
col 1 of f1 and f2
['2391', '50342'], ['2396', '10278']
col 2 of f1 and f2
['837', '45227'], ['3579', '1377']
col 3 of f1 and f2
['-837', '29681'], ['4210', '15674']
col 4 of f1 and f2
['-2385', '9751'], ['4209', '37549']
row 1
col 0 of f1 and f2
['3587', '69238'], ['841', '9397']
col 1 of f1 and f2
['2387', '48218'], ['2397', '21948']
col 2 of f1 and f2
['836', '604'], ['3573', '11963']
col 3 of f1 and f2
['-840', '75067'], ['4205', '89209']
col 4 of f1 and f2
['-2390', '17529'], ['4226', '73926']
row 2
col 0 of f1 and f2
['3588', '44531'], ['842', '01642']
col 1 of f1 and f2
['2387', '44556'], ['2397', '72266']
col 2 of f1 and f2
['836', '00555'], ['3573', '06494']
col 3 of f1 and f2
['-840', '79022'], ['4202', '88379']
col 4 of f1 and f2
['-2389', '77612'], ['4226', '93799']
row 3
col 0 of f1 and f2
['3588', '08203'], ['842', '22083']
col 1 of f1 and f2
['2388', '25439'], ['2397', '47974']
col 2 of f1 and f2
['836', '26544'], ['3574', '27515']
col 3 of f1 and f2
['-840', '17017'], ['4204', '19043']
col 4 of f1 and f2
['-2389', '07544'], ['4223', '8208']
row 4
col 0 of f1 and f2
['3587', '66553'], ['842', '42065']
col 1 of f1 and f2
['2389', '05566'], ['2397', '20142']
col 2 of f1 and f2
['836', '53046'], ['3575', '47437']
col 3 of f1 and f2
['-839', '53912'], ['4205', '52246']
col 4 of f1 and f2
['-2388', '40405'], ['4220', '64795']
Вы можете продолжить с этого момента, теперь (x, y) пары легко доступны. Я не знаю, что вы хотите сделать с pot = (x, y), поэтому я не могу помочь дальше.