Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #187 from scikit-hep/awkward-topandas-exoplanets
Browse files Browse the repository at this point in the history
Make awkward.topandas(exoplanets, flatten=True) work.
  • Loading branch information
jpivarski authored Sep 10, 2019
2 parents 1dc88a3 + e606e51 commit d942fb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion awkward/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def recurse(array, tpe, cols, seriously):
tpen = tpe[n]
colsn = cols + (n,) if seriously else cols

if isinstance(arrayn, awkward.array.objects.ObjectArray):
if isinstance(arrayn, awkward.array.objects.ObjectArray) and not isinstance(arrayn, awkward.array.objects.StringArray):
arrayn = arrayn.content
if not isinstance(tpen, (numpy.dtype, str, bytes, awkward.type.Type)):
tpen = awkward.type.fromarray(arrayn).to
Expand All @@ -296,6 +296,10 @@ def recurse(array, tpe, cols, seriously):
elif isinstance(tpen, awkward.type.TableType):
tmp = recurse(arrayn, tpen, colsn, True)

elif isinstance(tpen, awkward.type.OptionType) and isinstance(arrayn.content, numpy.ndarray):
columns.append(colsn)
tmp = numpy.ma.MaskedArray(arrayn.content, arrayn.boolmask(maskedwhen=True))

else:
raise ValueError("this array has unflattenable substructure:\n\n{0}".format(str(tpen)))

Expand Down
2 changes: 1 addition & 1 deletion awkward/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import re

__version__ = "0.12.8"
__version__ = "0.12.9"
version = __version__
version_info = tuple(re.split(r"[-\.]", __version__))

Expand Down

0 comments on commit d942fb8

Please sign in to comment.