| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
Also some PEP-8 fixes and test improvements
|
|
|
|
|
|
| |
Implemented a nanpercentile and associated tests
as an extension of np.percentile to complement the
other nanfunctions.
|
|
|
|
|
| |
The class is in numpy/lib/_version.py and can be used to compare
numpy versions when the version goes to double digits.
|
|
|
|
|
|
|
|
|
|
| |
Implemented a nanmedian and associated tests as an
extension of np.median to complement the other
nanfunctions
Added negative values to the unit tests
Cleaned up documentation of nanmedian
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This PR adds a new keyword argument to `np.unique` that returns the
number of times each unique item comes up in the array. This allows
replacing a typical numpy construct:
unq, _ = np.unique(a, return_inverse=True)
unq_counts = np.bincount(_)
with a single line of code:
unq, unq_counts = np.unique(a, return_counts=True)
As a plus, it runs faster, because it does not need the extra
operations required to produce `unique_inverse`.
|
|
|
|
| |
Resolves #2591. Adds more explicit error handling in line parsing loop.
|
|\
| |
| | |
MAINT (API?): organize npyio.recfromcsv defaults
|
| | |
|
|\ \
| | |
| | | |
BUG: fix some errors raised when minlength is incorrect in np.bincount
|
| | | |
|
|\ \ \
| |/ /
|/| | |
ENH: speed-up of triangular matrix functions
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* `np.tri` now produces less intermediate arrays. Runs about 40% faster for
general dtypes, up to 3x faster for boolean arrays.
* `np.tril` now does smarter type conversions (thanks Julian!), and together
with the improvements in `np.tri` now runs about 30% faster. `np.triu`
runs almost 2x faster than before, but still runs 20% slower than
`np.tril`, which is an improvement over the 50% difference before.
* `np.triu_indices` and `np.tril_indices` do not call `np.mask_indices`,
instead they call `np.where` directly on a boolean array created with
`np.tri`. They now run roughly 2x faster.
* Removed the constraint for the array to be square in calls to
`np.triu_indices`, `np.tril_indices`, `np.triu_indices_from` and
`np.tril_indices_from`.
|
|\ \ \
| | | |
| | | | |
ENH: Speed improvements and deprecations for np.select
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The idea for this (and some of the code) originally comes from
Graeme B Bell (gh-3537).
Choose is not as fast and pretty limited, so an iterative
copyto is used instead.
Closes gh-3259, gh-3537, gh-3551, and gh-3254
|
| | | | |
|
| |/ /
|/| |
| | |
| | |
| | | |
test for gh-4494
test median returns array scalars and works with object arrays
|
| | |
| | |
| | |
| | |
| | |
| | | |
Merging median and percentile make would break astropy and quantities as
we don't call mean anymore. These packages rely on overriding mean to
add their own median behavior.
|
| | | |
|
|/ / |
|
|\ \
| | |
| | | |
Fix stride_stricks.as_strided function for object arrays
|
| |/
| |
| |
| | |
Currently, calling as_strided for object array results in 'TypeError: Cannot change data-type for object array.'. Fix so that dtype of new array is only set for void dtype, as originally intended.
|
|\ \
| | |
| | | |
Closes issue #4266, fixes histogramdd treatment of events at rightmost binedge
|
| | |
| | |
| | |
| | | |
Fixes Github issue #4266
|
| |/
|/|
| |
| | |
closes gh-4295
|
|\ \
| | |
| | | |
BUG: Make interp return NaN at NaN interpolation points.
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A NaN interpolation point was interpreted as out of bounds on the left
side, hence the value of the left parameter in the function call was
returned.
>>> np.interp(np.nan, [-10, 10], [-2, 2])
-2.0
NaN is a better choice.
Closes #605.
|
| | |
|
| |
| |
| |
| |
| | |
Use `np.sort` instead of `sorted` when the input is a list and no indices
are requested. Fixes #2799.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a warning is ignored (or raised once) in python, the warnings
module will tag on a `__warningregistry__` dictionary to be able
to filter these warnings in the future. This is tagged on to the
current context, causing leakage to later calls (this is a bit
more complex, since where the registry ends up depends on the
layers between the original caller and warner).
In short, tests should typically not use ignore but catch the
warnings to avoid changing the user experience (or errors
on duplicate test runs).
Fixes an error on duplicate test runs (does not remove all
"ignores" which may change behaviour outside tests).
Closes gh-4340
|
|\
| |
| | |
BUG: check for monotonic bin arrays in digitize
|
| |
| |
| |
| |
| |
| | |
MAINT: rewrote `check_array_monotonic` to use array indices, not pointers.
TST: tests for proper handling of bins with all items almost equal now check
the return value for correctness, not just that an error is not raised.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The check for monotonic bin arrays of digitize doesn't properly handle
inputs with repeated entries at the beginning of the array:
```
>>> np.__version__
'1.8.0'
>>> np.digitize([1], [0, 0 , 2])
array([2], dtype=int64)
>>> np.digitize([1], [2, 2, 0])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: The bins must be monotonically increasing or decreasing
```
Modified `check_array_monotonic` in `_compiled_base.c` to skip over repeating
entries before deciding to check for increasing or decreasing monotonicity
and added relevant tests to `test_function_base.py`.
|
|\ \
| | |
| | | |
ENH: Reimplementing the indexing machinery
|
| | |
| | |
| | |
| | | |
Some optimizations still missing.
|
|\ \ \
| | | |
| | | | |
TST: clean up tempfile in test_closing_zipfile_after_load
|
| |/ / |
|
|/ / |
|
| |
| |
| |
| |
| | |
mktemp only returns a filename, a malicous user could replace it before
it gets used.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change corrects the following two bugs in numpy.irr:
* When the solution was negative, numpy.irr returned nan instead of the
correct solution because of the mask applied to the roots. Corrected
by removing the mask that 0 < res < 1.
* When multiple roots were found, numpy.irr was returning an array of
all roots rather than a single float. This bug was corrected by
selecting the single root closest to zero (min(abs(root)).
With these corrections, numpy.irr returns the same result as the
corresponding spreadsheet function in LibreOffice Calc for all test
cases (additional test cases were added to cover cases with multiple
positive and negative roots)
|
| |
|
|
|
|
|
|
| |
On linux large file support must be enabled and ftello used to avoid
overflows. The result must not be converted to a size_t, but a long
long.
|
|
|
|
| |
Observed on 32-bit linux with python 3.4b1
|
|\
| |
| | |
ENH: Allow meshgrid to take 1D and 0D inputs
|
| | |
|
|\ \
| | |
| | | |
FIX: Array split should not hack empty array shape away
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes the result type of empty output arrays.
The FutureWarning warns about changed behaviour. A "kludge" was
introduced into array split converting converting the result of
something like:
>>> np.array_split(np.array([[1, 1]]), 2)
[array([[1, 1]]), array([], dtype=int64)]
instead of retaining the shape of the empty/second array to
be (0, 2). A FutureWarning is now raised when such a
replacement occurs.
Closes gh-612
|
| |
| |
| |
| |
| | |
Speeds the test up vs. reading single bytes at a time, and is now
correctly handled when reading the magic string and array header.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This wrapper function is used everywhere in format.py now to ensure to
correctly the handle the case when fp.read returns fewer bytes than
requested.
Also added a test for the orignal bug, loading an array of size more
than 64K from a zip file.
|
| |
| |
| |
| |
| |
| | |
Issue 4093: Improved the handling of the case when the amount of data
read by fp.read is smaller than dtype.itemsize. Also changed the test
code to make sure this case is tested.
|