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 for pandas NAType #44

Open
jpivarski opened this issue Jan 12, 2024 · 1 comment
Open

Support for pandas NAType #44

jpivarski opened this issue Jan 12, 2024 · 1 comment

Comments

@jpivarski
Copy link
Collaborator

Copied from @xinyuejohn's issue on scikit-hep/awkward#2931:

Description of new feature

Hi, I was creating an awkward array using pandas dataframe and I found awkward doesn't support pandas._libs.missing.NAType()

It would be great if this NAType could be supported.

To replicate:

import awkward as ak
import pandas

a = ["a", "b", pandas._libs.missing.NAType()]
ak.Array(a)

Traceback:

ValueError: cannot convert <NA> (type NAType) to an array element

(https://github.com/scikit-hep/awkward/blob/awkward-cpp-26/awkward-cpp/src/python/content.cpp#L191)

This error occurred while calling

    ak.to_layout(
        ['a', 'b', <NA>]
        allow_record = False
        regulararray = False
        primitive_policy = 'error'
    )

See scikit-hep/awkward#2931 for more information, in particular

@martindurant
Copy link
Member

I was creating an awkward array using pandas dataframe

So we should intercept the data before conversion to ak.

Question: does arrow support this NA type? I suspect no, they alway use masks, and so we're only really concerned with 1-D regular series.

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

2 participants