Skip to content

Numpy returns strings if Pandas is not installed. #48

@paultiq

Description

@paultiq

What happens?

This test passes if Pandas is installed, yet fails if Pandas is not installed.

If Pandas is not installed, the result is:
[("{'3': 0}",), ("{'2': 1}",), ("{'1': 2}",)]
if Pandas is installed, the result is
[({'3': 0},), ({'2': 1},), ({'1': 2},)]

This test is from tests/fast/numpy/test_numpy_new_path.py, which fails when Pandas is not installed.

To Reproduce

Run this code with and without Pandas.

import numpy as np
import duckdb

print(np.__version__)
print(duckdb.__version__)

duckdb_cursor = duckdb.connect()

z = []
for i in range(3):
    z.append({str(3 - i): i})
z = np.array(z)
res = duckdb_cursor.sql("select * from z").fetchall()
print(res)
assert res == [
    ({'3': 0},),
    ({'2': 1},),
    ({'1': 2},),
]

Tested with a range of different numpy and pandas and duckdb versions, the only consistent thing with Pandas being installed or not installed.

OS:

Windows & Linux

DuckDB Package Version:

1.4.0dev (and prior versions)

Python Version:

3.13

Full Name:

Paul T

Affiliation:

Iqmo

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a nightly build

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration to reproduce the issue?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions