Skip to content
New issue

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

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

Already on GitHub? # to your account

numpy.exceptions.AxisError: axis 1 is out of bounds for array of dimension 1 #54848

Closed
anmyachev opened this issue Aug 29, 2023 · 2 comments · Fixed by #54914
Closed

numpy.exceptions.AxisError: axis 1 is out of bounds for array of dimension 1 #54848

anmyachev opened this issue Aug 29, 2023 · 2 comments · Fixed by #54914
Labels
ExtensionArray Extending pandas with custom dtypes or arrays. NA - MaskedArrays Related to pd.NA and nullable extension arrays Regression Functionality that used to work in a prior pandas version Reshaping Concat, Merge/Join, Stack/Unstack, Explode Strings String extension data type and string data
Milestone

Comments

@anmyachev
Copy link
Contributor

Reproducer:

import pandas as pd

df1 = pd.DataFrame(["a"]).convert_dtypes()
df2 = pd.DataFrame([1]).convert_dtypes()
pd.concat([df1, df2])  # <= numpy.exceptions.AxisError: axis 1 is out of bounds for array of dimension 1

Traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "Miniconda3\envs\modin\lib\site-packages\pandas\core\reshape\concat.py", line 393, in concat
    return op.get_result()
  File "Miniconda3\envs\modin\lib\site-packages\pandas\core\reshape\concat.py", line 680, in get_result
    new_data = concatenate_managers(
  File "Miniconda3\envs\modin\lib\site-packages\pandas\core\internals\concat.py", line 180, in concatenate_managers
    values = concat_compat(vals, axis=1, ea_compat_axis=True)
  File "Miniconda3\envs\modin\lib\site-packages\pandas\core\dtypes\concat.py", line 135, in concat_compat
    result = np.concatenate(to_concat_arrs, axis=axis)
numpy.exceptions.AxisError: axis 1 is out of bounds for array of dimension 1

pandas 2.1.0rc0

@lithomas1 lithomas1 added Reshaping Concat, Merge/Join, Stack/Unstack, Explode Regression Functionality that used to work in a prior pandas version Strings String extension data type and string data ExtensionArray Extending pandas with custom dtypes or arrays. NA - MaskedArrays Related to pd.NA and nullable extension arrays labels Aug 29, 2023
@lithomas1 lithomas1 added this to the 2.1.1 milestone Aug 29, 2023
@lithomas1
Copy link
Member

Hi,
Thanks for reporting this issue. I can confirm this is a regression from 2.0.3. Marking for 2.1.1.

Not sure if #53260 caused this (the erroring line is from there),
but cc @jbrockmendel just in case.

@jbrockmendel
Copy link
Member

haven't looked closely, but 53260 is entirely plausible as being responsible.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
ExtensionArray Extending pandas with custom dtypes or arrays. NA - MaskedArrays Related to pd.NA and nullable extension arrays Regression Functionality that used to work in a prior pandas version Reshaping Concat, Merge/Join, Stack/Unstack, Explode Strings String extension data type and string data
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants