Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src_cpp/numpy/numpy_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static NumpyNullableType convertNumpyTypeInternal(const std::string& colTypeStr)
return NumpyNullableType::DATETIME_NS;
}
// LCOV_EXCL_STOP
if (colTypeStr == "object" || colTypeStr == "string") {
if (colTypeStr == "object" || colTypeStr == "string" || colTypeStr == "str") {
return NumpyNullableType::OBJECT;
}
UNREACHABLE_CODE;
Expand Down
18 changes: 18 additions & 0 deletions test/test_scan_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,24 @@ def test_copy_from_pandas_object(conn_db_empty: ConnDB) -> None:
assert result.has_next() is False


def test_copy_from_pandas_str_dtype(conn_db_empty: ConnDB) -> None:
conn, _ = conn_db_empty
df = pd.DataFrame(
[
{"id": "a", "name": "x", "n": 1, "v": 1.5},
{"id": "b", "name": "y", "n": 2, "v": None},
]
)
conn.execute(
"CREATE NODE TABLE T(id STRING PRIMARY KEY, name STRING, n INT64, v DOUBLE)"
)
conn.execute("COPY T FROM df")
result = conn.execute("MATCH (t:T) RETURN t.id, t.name, t.n, t.v ORDER BY t.id")
assert result.get_next() == ["a", "x", 1, 1.5]
assert result.get_next() == ["b", "y", 2, None]
assert result.has_next() is False


def test_copy_from_pandas_object_skip(conn_db_empty: ConnDB) -> None:
conn, _ = conn_db_empty
df = pd.DataFrame(
Expand Down
Loading