summaryrefslogtreecommitdiff
path: root/numpy/lib/recfunctions.py
Commit message (Collapse)AuthorAgeFilesLines
* ENH: unstructured_to_structured converts dtype argument (#22442)LeonaTaric2022-10-191-0/+2
| | | | | | | | | | | | Before: >>> field = unstructured_to_structured(np.zeros((20, 2)), dtype=[('x', float), ('y', float)]) # failed >>> field = unstructured_to_structured(np.zeros((20, 2)), dtype=np.dtype([('x', float), ('y', float)])) # success After: >>> field = unstructured_to_structured(np.zeros((20, 2)), dtype=[('x', float), ('y', float)]) # success >>> field = unstructured_to_structured(np.zeros((20, 2)), dtype=np.dtype([('x', float), ('y', float)])) # success Closes gh-22428
* MAINT: rm old warningTyler Reddy2022-07-161-4/+1
| | | | | | * if you believe the comments that this warning suppression should be safe to remove after `1.16`, then it should be safe to remove now?
* Fix grammar [skip ci]Brigitta Sipőcz2022-05-211-2/+2
| | | Co-authored-by: Matti Picus <matti.picus@gmail.com>
* Fix docstring and examples for rfn.get_names*Brigitta Sipőcz2022-05-211-20/+13
|
* DOC: Fix some target not found Sphinx warnings. (#20140)Chiara Marmo2021-12-011-9/+12
|
* ENH: Add spaces after punctuation in dtype repr/str. (#19686)Antony Lee2021-09-291-1/+2
| | | | | | | | | | | | | | | | | Before: ``` In [1]: np.dtype({"names": ["a"], "formats": [int], "offsets": [2]}) Out[1]: dtype({'names':['a'], 'formats':['<i8'], 'offsets':[2], 'itemsize':10}) ``` After: ``` In [1]: np.dtype({"names": ["a"], "formats": [int], "offsets": [2]}) Out[1]: dtype({'names': ['a'], 'formats': ['<i8'], 'offsets': [2], 'itemsize': 10}) ``` * Allow switching back to old dtype printing format. * Add changelog.
* DOC: Fix syntax errors in docstrings for versionchanged, versionadded (#17338)Bradley Dice2020-09-171-1/+1
| | | * DOC: Fix typos in versionchanged.
* DOC: Fixed typo in lib/recfunctions.py (#16973)Jesse Li2020-07-291-2/+2
|
* STY: use 'yield from <expr>' for simple cases (#15444)Mike Taves2020-01-271-10/+6
| | | | | | | | | This PR uses simple cases of PEP 380 to rewrite: for v in g: yield v into: yield from <expr>
* MAINT: Replace basestring with str.Charles Harris2020-01-231-4/+3
| | | | | | | This replaces basestring with str except in - tools/npy_tempita/ - numpy/compat/py3k.py
* [MAINT] Cleanup python2 sys.version checksSeth Troisi2020-01-201-10/+1
|
* DOC: fix typosBrian Wignall2020-01-141-1/+1
|
* MAINT: Remove unnecessary 'from __future__ import ...' statementsJon Dufresne2020-01-031-2/+0
| | | | | As numpy is Python 3 only, these import statements are now unnecessary and don't alter runtime behavior.
* 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
|