diff options
author | Bharat123rox <bharatraghunthan9767@gmail.com> | 2019-05-12 22:10:24 +0530 |
---|---|---|
committer | Bharat123rox <bharatraghunthan9767@gmail.com> | 2019-05-12 22:10:24 +0530 |
commit | aa04be9e443e7c087c10989559af24e5ab6459f0 (patch) | |
tree | 8fa2a6b2b2b127a99c4aac5e94fb19be0d74642f /numpy/lib/recfunctions.py | |
parent | 4ebd08df74769ad0628a05e1d0654244008ab10b (diff) | |
parent | d2d589703d5ee743251fbc6ea045f28e1c5e9e71 (diff) | |
download | numpy-aa04be9e443e7c087c10989559af24e5ab6459f0.tar.gz |
Merge upstream branch 'master' of https://github.com/numpy/numpy into fix-genfromtxt
Diffstat (limited to 'numpy/lib/recfunctions.py')
-rw-r--r-- | numpy/lib/recfunctions.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/numpy/lib/recfunctions.py b/numpy/lib/recfunctions.py index 5ff35f0bb..08a9cf09c 100644 --- a/numpy/lib/recfunctions.py +++ b/numpy/lib/recfunctions.py @@ -976,11 +976,11 @@ def structured_to_unstructured(arr, dtype=None, copy=False, casting='unsafe'): # next cast to a packed format with all fields converted to new dtype packed_fields = np.dtype({'names': names, - 'formats': [(out_dtype, c) for c in counts]}) + 'formats': [(out_dtype, dt.shape) for dt in dts]}) arr = arr.astype(packed_fields, copy=copy, casting=casting) # finally is it safe to view the packed fields as the unstructured type - return arr.view((out_dtype, sum(counts))) + return arr.view((out_dtype, (sum(counts),))) def _unstructured_to_structured_dispatcher(arr, dtype=None, names=None, align=None, copy=None, casting=None): @@ -1069,7 +1069,7 @@ def unstructured_to_structured(arr, dtype=None, names=None, align=False, # first view as a packed structured array of one dtype packed_fields = np.dtype({'names': names, - 'formats': [(arr.dtype, c) for c in counts]}) + 'formats': [(arr.dtype, dt.shape) for dt in dts]}) arr = np.ascontiguousarray(arr).view(packed_fields) # next cast to an unpacked but flattened format with varied dtypes |