8000 DOC: Improve np.histogram documentation by TheHawz · Pull Request #25403 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

DOC: Improve np.histogram documentation #25403

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
DOC: fix code sampes format.
It must be ``text``and not `text` for inline code samples.
  • Loading branch information
sp-pablo-losada committed Dec 16, 2023
commit f557bd739f4376ff1d2b07441709723fc1350c45
20 changes: 10 additions & 10 deletions numpy/lib/_histograms_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,27 +687,27 @@ def histogram(a, bins=10, range=None, density=None, weights=None):
a : array_like
Input data. The histogram is computed over the flattened array.
bins : int or sequence of scalars or str, optional
If `bins` is an int, it defines the number of equal-width
bins in the given range (10, by default). If `bins` is a
If ``bins`` is an int, it defines the number of equal-width
bins in the given range (10, by default). If ``bins`` is a
sequence, it defines a monotonically increasing array of bin edges,
including the rightmost edge, allowing for non-uniform bin widths.

.. versionadded:: 1.11.0

If `bins` is a string, it defines the method used to calculate the
optimal bin width, as defined by `histogram_bin_edges`.
If ``bins`` is a string, it defines the method used to calculate the
optimal bin width, as defined by ``histogram_bin_edges``.

range : (float, float), optional
The lower and upper range of the bins. If not provided, range
is simply ``(a.min(), a.max())``. Values outside the range are
ignored. The first element of the range must be less than or
equal to the second. `range` affects the automatic bin
equal to the second. ``range`` affects the automatic bin
computation as well. While bin width is computed to be optimal
based on the actual data within `range`, the bin count will fill
based on the actual data within ``range``, the bin count will fill
the entire range including portions containing no data.
weights : array_like, optional
An array of weights, of the same shape as `a`. Each value in
`a` only contributes its associated weight towards the bin count
An array of weights, of the same shape as ``a``. Each value in
``a`` only contributes its associated weight towards the bin count
(instead of 1). If `density` is True, the weights are
normalized, so that the integral of the density over the range
remains 1.
Expand All @@ -724,7 +724,7 @@ def histogram(a, bins=10, range=None, density=None, weights=None):
Returns
-------
hist : array
The values of the histogram. See `density` and `weights` for a
The values of the histogram. See ``density`` and ``weights`` for a
description of the possible semantics.
bin_edges : array of dtype float
Return the bin edges ``(length(hist)+1)``.
Expand All @@ -737,7 +737,7 @@ def histogram(a, bins=10, range=None, density=None, weights=None):
Notes
-----
All but the last (righthand-most) bin is half-open. In other words,
if `bins` is::
if ``bins`` is::

[1, 2, 3, 4]

Expand Down
0