Skip to content

BUG: Series construction with dtype=ArrowBoolDtype() and index but no data fails #33899

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

Closed
3 tasks done
simonjayhawkins opened this issue Apr 30, 2020 · 1 comment
Closed
3 tasks done
Labels
API - Consistency Internal Consistency of API/Behavior Arrow pyarrow functionality Bug Constructors Series/DataFrame/Index/pd.array Constructors ExtensionArray Extending pandas with custom dtypes or arrays.

Comments

@simonjayhawkins
Copy link
Member

simonjayhawkins commented Apr 30, 2020

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Code Sample, a copy-pastable example

>>> import numpy as np
>>> import pandas as pd
>>>
>>> pd.__version__
'1.1.0.dev0+1436.g6016b9841'
>>>
>>> from pandas.tests.extension.arrow.arrays import ArrowBoolDtype
>>>
>>> pd.Series(index=[1, 2, 3], dtype=ArrowBoolDtype())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\simon\pandas\pandas\core\series.py", line 283, in __init__
    data, index = self._init_dict(data, index, dtype)
  File "C:\Users\simon\pandas\pandas\core\series.py", line 372, in _init_dict
    s = create_series_with_explicit_dtype(
  File "C:\Users\simon\pandas\pandas\core\construction.py", line 624, in create_series_with_explicit_dtype
    return Series(
  File "C:\Users\simon\pandas\pandas\core\series.py", line 329, in __init__
    data = sanitize_array(data, index, dtype, copy, raise_cast_failure=True)
  File "C:\Users\simon\pandas\pandas\core\construction.py", line 454, in sanitize_array
    subarr = _try_cast(data, dtype, copy, raise_cast_failure)
  File "C:\Users\simon\pandas\pandas\core\construction.py", line 537, in _try_cast
    subarr = array_type(arr, dtype=dtype, copy=copy)
  File "C:\Users\simon\pandas\pandas\tests\extension\arrow\arrays.py", line 82, in _from_sequence
    return cls.from_scalars(scalars)
  File "C:\Users\simon\pandas\pandas\tests\extension\arrow\arrays.py", line 72, in from_scalars
    arr = pa.chunked_array([pa.array(np.asarray(values))])
  File "pyarrow\array.pxi", line 265, in pyarrow.lib.array
  File "pyarrow\array.pxi", line 80, in pyarrow.lib._ndarray_to_array
  File "pyarrow\error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: only handle 1-dimensional arrays
>>>

Problem description

raises pyarrow.lib.ArrowInvalid

Expected Output

1 pa.NULL
2 pa.NULL
3 pa.NULL
dtype: arrow_bool

Output of pd.show_versions()

[paste the output of pd.show_versions() here leaving a blank line after the details tag]

@simonjayhawkins simonjayhawkins added Bug Needs Triage Issue that has not been reviewed by a pandas team member IO Parquet parquet, feather and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 30, 2020
@jorisvandenbossche jorisvandenbossche added ExtensionArray Extending pandas with custom dtypes or arrays. and removed IO Parquet parquet, feather labels Apr 30, 2020
@simonjayhawkins simonjayhawkins added the API - Consistency Internal Consistency of API/Behavior label May 1, 2020
@jbrockmendel jbrockmendel added the Constructors Series/DataFrame/Index/pd.array Constructors label Jan 11, 2022
@jbrockmendel jbrockmendel added the Arrow pyarrow functionality label Oct 17, 2022
@mroeschke
Copy link
Member

After #49000 this usage was removed since we have a dedicated public pd.ArrowDtype now so closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Arrow pyarrow functionality Bug Constructors Series/DataFrame/Index/pd.array Constructors ExtensionArray Extending pandas with custom dtypes or arrays.
Projects
None yet
Development

No branches or pull requests

4 participants