Skip to content

Commit

Permalink
Eliminate local n which shadows a non-local n
Browse files Browse the repository at this point in the history
  • Loading branch information
rhettinger committed Jun 1, 2024
1 parent 11b3c6f commit b48e38e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Lib/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,12 +976,10 @@ def kde(data, h, kernel='normal', *, cumulative=False):
if support is None:

def pdf(x):
n = len(data)
return sum(K((x - x_i) / h) for x_i in data) / (n * h)
return sum(K((x - x_i) / h) for x_i in data) / (len(data) * h)

def cdf(x):
n = len(data)
return sum(W((x - x_i) / h) for x_i in data) / n
return sum(W((x - x_i) / h) for x_i in data) / len(data)

else:

Expand Down

0 comments on commit b48e38e

Please sign in to comment.