I have 47 set of data to be analysised using Python with the following forma t and I stored the data in 2D array:
2104,3,399900 1600,3,329900 2400,3,369000...
I use len function to print the item stored in array. (The previous one has made some mistake and change to following code.)
array: with open("abc.txt", "r") as ins:
substrings = data.read().split()
array = [map(int, substring.split(',')) for substring in substrings]
print(len(array)[0])
A part from that I also would like to do some calculation like this for each a, b and c in array like thos format:
(2104-500)**2+(1600-500)**2+...
(3-2)**2+(3-2)**2...
I wrote:
for [a for a, b, c in array] in range (len(array)[0]):
calculation_1 = ([a for a, b, c in array]) - 500)**2for [b for a, b, c in array] in range (len(array)[1]):
calculation_2 = ([b for a, b, c in array]) - 2)**2
How can I improve the code to give the answer I want?