Python Forum
Comparing complicated arrays.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Comparing complicated arrays.
#1
Hello. Do you have any idea how to compare this example two arrays? Here it's not visable. But nummber of columns in both arrays is the same, but number of items is different. So for example, zero in first row, column third corresponds to number in first row, third column etc. So I'd like to put corresponding numbers into subsets "0", "1" and "unknown". Maybe you have at least an idea on method. Thanks in advance :)

#Array1
COLUMNS_1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 0 1 0 1

#Array2
Trxxx HAEIAM texttex texxx texx rexx rr rxx texx text t 3.86 3.58 3.54 3.70 3.08 3.17 3.75 3.23 3.72 3.11 3.65 3.87 3.21 3.58 3.10 3.87 4.31 3.97 3.69 3.47 3.49 3.23 3.69 3.73 3.61 3.59 3.56 3.46 3.53 3.57 3.19 3.42 3.77 3.34 3.39 3.34 3.02 3.33 3.07 3.74 3.42 3.12 3.31 3.57 2.92 3.48 2.77 3.00 3.54 3.36 3.53 3.51 3.67 2.76 3.39 3.22 3.31 3.82 3.71 3.38 3.60 3.54
Reply
#2
Quote:So for example, zero in first row, column third
zero based, columns_1[3] is a 1, not 0, so assume you mean index 2 for column 3, correct?
>>> zz = '0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 0 1 0 1'
>>> columns_1 = zz.split()
>>> columns_1[3]
'1'
>>>
Hard to understand your goal. Please show example result
Reply
#3
So it's difficult to explain how the file looks. I copied a part to editor and shared a link:

https://ibb.co/YNkXNB7

So an example output would be:

#unknown
3.22 3.31 3.82 3.71 3.38 3.60 3.54

#1
3.86 3.54 3.08 3.75 3.21 3.10 4.31 3.39 3.34 3.42 3.31 3.57 2.77 3.00

#the same for 0
Reply
#4
Ok, next question, what have you tried?
Please post code
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020