I am trying to make a matrix with my data:
matrix_model1 matrix_model2
7.0 2.0
4.0 4.0
30.0 20.0
4.0 8.0
I am trying to calculate the value of intersection:
m = []
for i in range(0, len(df2)):
m.append(len(set(df2['matrix_model1'].iloc[i]).intersection(df2['matrix_model2'].iloc[i])))
df2['Model1_Intersection'] = m
df2
But I am getting an error:
TypeError: 'numpy.float64' object is not iterable
I tried to change it to int by .astype('Int64') but it does not work, can anyone tell where am I going wrong?