Skip to content

BUG: (regression? v2 vs v1.5) ValueError: Big-endian buffer not supported on little-endian compiler #53234

Open
@st-bender

Description

@st-bender

Pandas version checks

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

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

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import numpy as np
import pandas as pd
import xarray as xr

ds = xr.Dataset(
    {
        "a": (("x", "y"), np.arange(24).reshape((6, 4)))
    },
    coords={"x": np.arange(6, dtype=">f4")}
)

# raises
# ValueError: Big-endian buffer not supported on little-endian compiler
# on pandas 2.0.1 but *not* on pandas 1.5.3
dsi = ds.interp(x=np.array([1.3, 2.5]))

Issue Description

Hi there,
I onserved that one of my tests failed with
ValueError: Big-endian buffer not supported on little-endian compiler
which had no problem before.
I am not sure what changed internally and how, but observed that this is raised when using pandas version 2 and still succeeds with pandas 1.5.

I found some old reports and the FAQ, but since the behaviour is different between versions, this might be of interest anyway. Or maybe I need to file it with xarray.

The full traceback is:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py39/lib/python3.9/site-packages/xarray/core/dataset.py:3366: in interp
    obj, newidx = missing._localize(obj, {k: v})
.tox/py39/lib/python3.9/site-packages/xarray/core/missing.py:565: in _localize
    imin = index.get_indexer([minval], method="nearest").item()
.tox/py39/lib/python3.9/site-packages/pandas/core/indexes/base.py:3730: in get_indexer
    if not self._index_as_unique:
.tox/py39/lib/python3.9/site-packages/pandas/core/indexes/base.py:6006: in _index_as_unique
    return self.is_unique
pandas/_libs/properties.pyx:36: in pandas._libs.properties.CachedProperty.__get__
    ???
.tox/py39/lib/python3.9/site-packages/pandas/core/indexes/base.py:2238: in is_unique
    return self._engine.is_unique
pandas/_libs/index.pyx:236: in pandas._libs.index.IndexEngine.is_unique.__get__
    ???
pandas/_libs/index.pyx:241: in pandas._libs.index.IndexEngine._do_unique_check
    ???
pandas/_libs/index.pyx:303: in pandas._libs.index.IndexEngine._ensure_mapping_populated
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   ???
E   ValueError: Big-endian buffer not supported on little-endian compiler

pandas/_libs/hashtable_class_helper.pxi:7104: ValueError

A slightly different test provides also the function name:

File "pandas/_libs/hashtable_class_helper.pxi", line 7104, in pandas._libs.hashtable.PyObjectHashTable.map_locations
ValueError: Big-endian buffer not supported on little-endian compiler

Expected Behavior

No exception is raised.

Installed Versions

INSTALLED VERSIONS

commit : 37ea63d
python : 3.9.16.final.0
python-bits : 64
OS : Linux
OS-release : 3.10.0-1160.71.1.el7.x86_64
Version : #1 SMP Tue Jun 28 15:37:28 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : en_GB.UTF-8
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8

pandas : 2.0.1
numpy : 1.24.3
pytz : 2023.3
dateutil : 2.8.2
setuptools : 67.4.0
pip : 23.0.1
pytest : 7.3.1
scipy : 1.10.1
xarray : 2023.4.2
tzdata : 2023.3

(all others are "none")

Metadata

Metadata

Assignees

No one assigned

    Labels

    ConstructorsSeries/DataFrame/Index/pd.array ConstructorsRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions