I am trying to find the probability that a value in a column is equal to the columns mean. I have tried the following:
count = 0
for column_name, column_data in creoles[creoles.columns[2:]].iteritems():
mode = creoles[column_name].mode()
data = creoles[column_name].tolist()
for i in data:
for j in mode:
if i == j:
count += 1
baseline = round(count / len(data), 3)
count = 0
but I recieve the following Error:
A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead
I am not sure if that applies to my specific situation, or if it does how I would go about doing that. I've looked online for a while and couldn't find a solution. Thanks in advance