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

[Python] Dictionary has out-of-bound index when creating DictionaryArray from Pandas with NaN #19704

Closed
asfimport opened this issue Oct 1, 2018 · 3 comments

Comments

@asfimport
Copy link

Minimal reproducer:

import pandas as pd
import pyarrow as pa

pa.array(pd.Categorical(['a', 'b', 'c'], categories=['a', 'b']))

Reporter: Keith Kraus / @kkraus14
Assignee: Wes McKinney / @wesm

PRs and other links:

Note: This issue was originally created as ARROW-3374. Please see the migration documentation for further details.

@asfimport
Copy link
Author

Wes McKinney / @wesm:
You have to pass from_pandas=True

In [4]: pa.array(pd.Categorical(['a', 'b', 'c'], categories=['a', 'b']), from_pandas=True)
Out[4]: 
<pyarrow.lib.DictionaryArray object at 0x7fd2064810a8>

-- dictionary:
  [
    "a",
    "b"
  ]
-- indices:
  [
    0,
    1,
    null
  ]

@asfimport
Copy link
Author

Wes McKinney / @wesm:
Actually, I think in this case we can safely assume the user's intent is to respect pandas's nulls. I will fix

@asfimport
Copy link
Author

Wes McKinney / @wesm:
Issue resolved by pull request 2670
#2670

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

No branches or pull requests

2 participants