10000 MAINT: More Histogramdd cleanup by eric-wieser · Pull Request #10863 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: More Histogramdd cleanup #10863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 9, 2018
Prev Previous commit
Next Next commit
MAINT: Don't use a dict with numeric keys when a tuple would do fine
  • Loading branch information
eric-wieser committed Apr 8, 2018
commit f4df81f8dcd5c7361a273b7c6cf294a9e8c0841c
7 changes: 4 additions & 3 deletions numpy/lib/histograms.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,9 +899,10 @@ def histogramdd(sample, bins=10, range=None, normed=False, weights=None):
return np.zeros(nbin-2), edges

# Compute the bin number each sample falls into.
Ncount = {}
for i in np.arange(D):
Ncount[i] = np.digitize(sample[:, i], edges[i])
Ncount = tuple(
np.digitize(sample[:, i], edges[i])
for i in np.arange(D)
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these look better when aligned with the arguments.


# Using digitize, values that fall on an edge are put in the right bin.
# For the rightmost bin, we want values equal to the right edge to be
Expand Down
0