summaryrefslogtreecommitdiff
path: root/numpy/lib/recfunctions.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #14511 from eric-wieser/fix-flatten_dtypeMatti Picus2019-09-161-1/+1
|\ | | | | BUG: Fix flatten_dtype so that nested 0-field structs are flattened correctly
| * BUG: Fix flatten_dtype so that nested 0-field structs are flattened correctlyEric Wieser2019-09-141-1/+1
| | | | | | | | This affects the behavior of merge_arrays.
* | API: Do not return None from recfunctions.drop_fieldsEric Wieser2019-09-141-3/+5
|/ | | | This return value was not documented and did not make any sense. There's no reason to have a special case here.
* Merge pull request #14310 from ahaldane/fix_struct_to_unstruct_nestingCharles Harris2019-08-231-7/+39
|\ | | | | MAINT: Fix behavior of structured_to_unstructured on non-trivial dtypes
| * MAINT: fix behavior of structured_to_unstructured on non-trivial dtypesAllan Haldane2019-08-231-7/+39
| | | | | | | | Fixes #13333
* | Merge remote-tracking branch 'upstream/master' into fix-if-fieldsEric Wieser2019-08-191-93/+99
|\ \ | |/
| * fixed unstructured_to_structured in recfunctionsColin Snyder2019-07-201-3/+9
| |
| * Removed unnecessary decorators and dispatcher functionsColin Snyder2019-07-151-15/+0
| |
| * exported correct functions and made private the restColin Snyder2019-07-141-25/+27
| |
| * add new recfunctions to __all__Colin Snyder2019-07-101-11/+16
| |
| * MAINT: Misc. typo fixes (#13664)luzpaz2019-05-311-1/+1
| | | | | | | | | | | | * DOC, MAINT: Misc. typo fixes Found via `codespell`
| * Merge pull request #13332 from eric-wieser/fix-subarray-unstructuredCharles Harris2019-05-111-2/+2
| |\ | | | | | | BUG: Always return views from structured_to_unstructured when possible
| | * BUG: Always return views from structured_to_unstructured when possibleEric Wieser2019-05-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Also applies to unstructured_to_structured While producing correct resutls, the test added in this commit would previously make an unecessary copy, causing the assertion to fail. The cause was `astype` was being asked to convert from a subarray of shape `(x, y)` to one of `(x*y,)`, which it cannot do without making a copy. This changes the approach used to skip the step of flattening subarrays to 1d
| * | Merge remote-tracking branch 'upstream/master' into fix-1-field-unstructuredEric Wieser2019-04-231-47/+55
| |\ \ | | |/ | |/|
| | * MAINT: include recfunctions moduleTyler Reddy2018-12-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | * added lib.recfunctions to refguide PUBLIC_SUBMODULES, as the doctests were otherwise not getting executed * fixed a failing doctest in recfunctions after above activation
| | * MAINT: address several reviewer commentsTyler Reddy2018-12-141-1/+1
| | |
| | * TST, DOC: enable refguide_checkTyler Reddy2018-12-141-46/+54
| | | | | | | | | | | | | | | | | | | | | | | | * ported the refguide_check module from SciPy for usage in NumPy docstring execution/ verification; added the refguide_check run to Azure Mac OS CI * adjusted NumPy docstrings such that refguide_check passes
| * | BUG: Fix structured_to_unstructured on single-field typesEric Wieser2019-04-151-1/+1
| |/ | | | | | | | | | | Previously a single-field type would decay, which is undesirable. The included test previously did not pass
* | MAINT: Fix remaining misuses of bool(dt.names)Eric Wieser2019-08-191-3/+3
| | | | | | | | It's not clear that these have any visible effect, but we should be consistent with how we detect structured types.
* | MAINT: Remove incorrect comment about flatteningEric Wieser2019-08-191-2/+2
| | | | | | | | | | Also adjust the code to more clearly indicate what actually happens. The behavior is identical before and after this patch.
* | BUG: recfunctions: Don't return None in place of empty sequencesEric Wieser2019-08-191-6/+6
|/ | | | | | Replacing empty tuples with `None` is a bad idea, and just results in an API that is hard to consume - especially since the behavior was never documented. This affects `get_names`, `get_names_flat`, and `get_fieldstructure`.
* MAINT: Fixups to new functions in np.lib.recfunctionsAllan Haldane2018-11-261-13/+28
|
* MAINT: Add new recfunctions to numpy function APIAllan Haldane2018-11-231-0/+23
|
* ENH: Fixups to multi-field assignment helpersAllan Haldane2018-11-221-42/+64
|
* ENH: add multi-field assignment helpers in np.lib.recfunctionsAllan Haldane2018-10-311-1/+280
| | | | | | Adds helper functions for the copy->view transition for multi-field indexes. Adds `structured_to_unstructured`, `apply_along_fields`, `assign_fields_by_name`, `require_fields`.
* ENH: __array_function__ support for np.lib, part 2/2 (#12119)Stephan Hoyer2018-10-221-1/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ENH: __array_function__ support for np.lib, part 2 xref GH12028 np.lib.npyio through np.lib.ufunclike * Fix failures in numpy/core/tests/test_overrides.py * CLN: handle depreaction in dispatchers for np.lib.ufunclike * CLN: fewer dispatchers in lib.twodim_base * CLN: fewer dispatchers in lib.shape_base * CLN: more dispatcher consolidation * BUG: fix test failure * Use all method instead of function in assert_equal * DOC: indicate n is array_like in scimath.logn * MAINT: updates per review * MAINT: more conservative changes in assert_array_equal * MAINT: add back in comment * MAINT: casting tweaks in assert_array_equal * MAINT: fixes and tests for assert_array_equal on subclasses
* MAINT: push back multifield copy->view changes to 1.16Allan Haldane2018-06-111-0/+78
|
* DOC: add existing recfunctions documentation to outputmattip2018-06-011-6/+7
|
* MAINT: Avoid one more use of descrEric Wieser2017-07-011-11/+6
|
* MAINT: remove tuple<->list conversion danceEric Wieser2017-07-011-30/+31
|
* MAINT: Shortcut for flat dtypes wasn't used for scalar dtypesEric Wieser2017-07-011-3/+3
|
* BUG: flatten_descr returns string not dtype for scalar dtypeEric Wieser2017-07-011-1/+1
|
* MAINT: Stop using .descr in recfunctionsEric Wieser2017-07-011-18/+22
| | | | This change shouldn't affect behaviour - all old uses were still correct.
* BUG: stack_arrays fails for subdtypesEric Wieser2017-07-011-5/+5
| | | | Again, fixed by not using descr
* BUG: recfunctions.join_by fails when key is a subdtypeEric Wieser2017-07-011-11/+47
| | | | | | | | | It seems that working with .descr is a generally terrible idea. Instead we introduce `get_fieldspec`, which returns a list of 2-tuples, encapsulating subdtypes. This also means that np.core.test_rational.rational survives a roundtrip - its .descr is 'V8', which ddoesn't survive
* BUG: recfunctions.join_by fails for colliding values with different dtypesEric Wieser2017-07-011-11/+12
| | | | Fixes #9338
* MAINT: use set operators for brevityEric Wieser2017-07-011-3/+3
|
* BUG: Preserve field order in join_by, avoids FutureWarningAllan Haldane2017-05-091-5/+35
| | | | Fixes #8940
* MAINT: We can now rely on itertools.izip_longest existingEric Wieser2017-02-231-13/+9
|
* DOC: Reconcile docstrings and function signatures where they disagreeRobert McGibbon2015-03-021-2/+2
| | | | | Fixed typos in docstrings were updated for functions where the parameter names in the docstring didn't match the function signature.
* STY: Make files in numpy/lib PEP8 compliant.Charles Harris2014-07-311-59/+57
| | | | The rules enforced are the same as those used for scipy.
* MAINT: Fixes for problems in numpy/lib revealed by pyflakes.Charles Harris2014-07-311-11/+10
| | | | | | Some of those problems look like potential coding errors. In those cases a Fixme comment was made and the offending code, usually an unused variable, was commented out.
* STY: Giant comma spacing fixup.Charles Harris2013-08-181-1/+1
| | | | | | | Run the 2to3 ws_comma fixer on *.py files. Some lines are now too long and will need to be broken at some point. OTOH, some lines were already too long and need to be broken at some point. Now seems as good a time as any to do this with open PRs at a minimum.
* MAINT: Use from future_builtins zip and map.Charles Harris2013-04-211-7/+5
| | | | | | For Python versions 2.6 and 2.7 the iterator forms of zip and map can be imported from future_builtins. That is done here so as to avoid using itertools.{izip, imap}.
* 2to3: Apply basestring fixer.Charles Harris2013-04-131-0/+1
| | | | | | | | | | | The basestring class is not defined in Python 3 and the fixer replaces it with str. In order to have a common code base we define basestring in numpy/compat/py3k.py to be str when the Python version is >= 3, otherwise basestring and import it where needed. That works for most cases, but there are a few files where the version dependent define needs to be in the file. Closes #3042.
* 2to3: Apply itertools fixer.Charles Harris2013-04-121-3/+8
| | | | | | | | | | | | | In Python 3 zip, map, and filter are all iterators, consequently the itertools variants izip, imap, and ifilter have been removed and the itertools fixer replaces them with the unprefixed names. Because the places where the iterator variants are used in current look like places where the iterator version might be useful, the approach taken here is to define the prefixed versions to the unprefixed versions for Python 3, but otherwise import them from itertools. Closes #3233.
* 2to3: Apply `map` fixer.Charles Harris2013-04-101-1/+1
| | | | | | | | | | | | | | | | | | | In Python 3 `map` is an iterator while in Python 2 it returns a list. The simple fix applied by the fixer is to inclose all instances of map with `list(...)`. This is not needed in all cases, and even where appropriate list comprehensions may be preferred for their clarity. Consequently, this patch attempts to use list comprehensions where it makes sense. When the mapped function has two arguments there is another problem that can arise. In Python 3 map stops execution when the shortest argument list is exhausted, while in Python 2 it stops when the longest argument list is exhausted. Consequently the two argument case might need special care. However, we have been running Python3 converted versions of numpy since 1.5 without problems, so it is probably not something that affects us. Closes #3068
* 2to3: apply `dict` fixer.Charles Harris2013-04-061-1/+1
| | | | | | | | | | | | | | | In Python3 `dict.items()`, `dict.keys()`, and `dict.values()` are iterators. This causes problems when a list is needed so the 2to3 fixer explicitly constructs a list when is finds on of those functions. However, that is usually not necessary, so a lot of the work here has been cleaning up those places where the fix is not needed. The big exception to that is the `numpy/f2py/crackfortran.py` file. The code there makes extensive use of loops that modify the contents of the dictionary being looped through, which raises an error. That together with the obscurity of the code in that file made it safest to let the `dict` fixer do its worst. Closes #3050.
* 2to3: Apply `print` fixer.Charles Harris2013-04-061-1/+1
| | | | | | | Add `print_function` to all `from __future__ import ...` statements and use the python3 print function syntax everywhere. Closes #3078.
* 2to3: Use absolute imports.Charles Harris2013-03-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new import `absolute_import` is added the `from __future__ import` statement and The 2to3 `import` fixer is run to make the imports compatible. There are several things that need to be dealt with to make this work. 1) Files meant to be run as scripts run in a different environment than files imported as part of a package, and so changes to those files need to be skipped. The affected script files are: * all setup.py files * numpy/core/code_generators/generate_umath.py * numpy/core/code_generators/generate_numpy_api.py * numpy/core/code_generators/generate_ufunc_api.py 2) Some imported modules are not available as they are created during the build process and consequently 2to3 is unable to handle them correctly. Files that import those modules need a bit of extra work. The affected files are: * core/__init__.py, * core/numeric.py, * core/_internal.py, * core/arrayprint.py, * core/fromnumeric.py, * numpy/__init__.py, * lib/npyio.py, * lib/function_base.py, * fft/fftpack.py, * random/__init__.py Closes #3172