I am trying to replace string values in an array with the array median, but I am getting an error code when I try to make a boolean. I have a defined array with 3 string values and the code I am trying to enter is:
arr2 = np.array ([1,2,3,1,5,2,3,4,2,
4,1,3,4,1,2,5,3,2,
1,"?",1,"n",3,2,5,
1,2,"Nan",3,2,2,4,3])
flag_good = [element.isdigit() for element in arr2]
flag_bad = ~flag_good
but I get an error code when running the line:
flag_bad = ~flag_good
How would I go about replacing the sting values with the array's median?