fix code quality issues
This commit is contained in:
@ -2,11 +2,11 @@ import math
|
||||
|
||||
|
||||
def shannon_entropy(data):
|
||||
sum = 0.0
|
||||
s = 0.0
|
||||
total = len(data)
|
||||
for x in range(0, 256):
|
||||
freq = data.count(x)
|
||||
p = freq / total
|
||||
if p > 0:
|
||||
sum -= p * math.log2(p)
|
||||
return sum
|
||||
s -= p * math.log2(p)
|
||||
return s
|
||||
|
Reference in New Issue
Block a user