diff --git a/pandas/_libs/include/pandas/vendored/klib/khash_python.h b/pandas/_libs/include/pandas/vendored/klib/khash_python.h index 56afea049c1ec..76b212a4b4660 100644 --- a/pandas/_libs/include/pandas/vendored/klib/khash_python.h +++ b/pandas/_libs/include/pandas/vendored/klib/khash_python.h @@ -2,10 +2,14 @@ #include -// use numpy's definitions for complex -#include -typedef npy_complex64 khcomplex64_t; -typedef npy_complex128 khcomplex128_t; +typedef struct { + float real; + float imag; +} khcomplex64_t; +typedef struct { + double real; + double imag; +} khcomplex128_t; diff --git a/pandas/tests/io/formats/test_printing.py b/pandas/tests/io/formats/test_printing.py index d21da4ec93318..2d0dc0d937709 100644 --- a/pandas/tests/io/formats/test_printing.py +++ b/pandas/tests/io/formats/test_printing.py @@ -237,7 +237,7 @@ def test_multiindex_long_element(): @pytest.mark.parametrize("as_frame", [True, False]) def test_ser_df_with_complex_nans(data, output, as_frame): # GH#53762, GH#53841 - obj = pd.Series(data) + obj = pd.Series(np.array(data)) if as_frame: obj = obj.to_frame(name="val") reprs = [f"{i} {val}" for i, val in enumerate(output)] @@ -245,4 +245,4 @@ def test_ser_df_with_complex_nans(data, output, as_frame): else: reprs = [f"{i} {val}" for i, val in enumerate(output)] expected = "\n".join(reprs) + "\ndtype: complex128" - assert str(obj) == expected + assert str(obj) == expected, f"\n{str(obj)}\n\n{expected}"