Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support missing key-value pairs when creating array #386

Open
mrocklin opened this issue Oct 16, 2015 · 0 comments
Open

Support missing key-value pairs when creating array #386

mrocklin opened this issue Oct 16, 2015 · 0 comments

Comments

@mrocklin
Copy link

It looks like the JSON parser is able to avoid missing key-value pairs for option types

In [3]: nd.parse_json('{x: int, y: ?int}', '{"x": 5}')
Out[3]: 
nd.array([5, NA],
         type="{x: int32, y: ?int32}")

This is great. It would be much greater if it also worked when creating an array from Python objects (this is, at least for me, far more valuable than parsing text).

In [5]: nd.array({'x': 5}, '{x: int, y: ?int}')
BroadcastError: python dict does not contain the field "y" as required by the data type {x: int32, y: ?int32}

While I'm here, it's odd that those two functions have reversed signatures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant