I have 50 folders containing the same file name but different contents Data_220_beta_0.1_47.0_53.0ND.csv. I am skipping certain folders which is mentioned in list I. Now, when the code scans all the remaining folders, it looks for values which are different and X = [x for x in X if min(x) != max(x)] contains the lists with distinct values. How do I identify the corresponding i values which have distinct list elements? The current and expected outputs are presented.
from functools import reduce
import pandas as pd
N=50
A=[]
X=[]
I=[8, 11, 19, 37, 40, 42]
for i in range(1,N+1):
if i in I:
continue
file_loc =f"C:\\Users\\{i}\\Data_220_beta_0.1_47.0_53.0ND.csv"
df = pd.read_csv(file_loc)
A=df["% of Nodes not visited"].to_numpy()
A = [x for x in A if str(x) != 'nan']
#print(A)
A = [eval(e) for e in A]
#print(A)
X.append(A)
X = [x for x in X if min(x) != max(x)]
print("i =",i)
The current output is
i=50
The expected output is
i=[20,27,37,45,48,50]