I have a dictionary with key-value pair columns name and value as a list of allowed values in that columns
How to replace values that are not occurring in the dictionary list with '0'
FinalCat_ is the column names list CombinedCat is Vaex df AllowedCatColValuesFast is dictionary
def returnVal(x, li):
if x in li:
return x
else:
return '0'
for i in FinalCat_:
CombinedCat[i+"Mod"] = CombinedCat.apply(returnVal, [CombinedCat[i], AllowedCatColValuesFast[i]])
so when I do .value_counts() it gives me an error list index out of range for the new columns which are created.