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
5 changes: 3 additions & 2 deletions python/pyarrow/src/arrow/python/arrow_to_pandas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1127,8 +1127,9 @@ class TypedPandasWriter : public PandasWriter {

Status CheckTypeExact(const DataType& type, Type::type expected) {
if (type.id() != expected) {
// TODO(wesm): stringify NumPy / pandas type
return Status::NotImplemented("Cannot write Arrow data of type ", type.ToString());
return Status::NotImplemented("Cannot write Arrow data of type ", type.ToString(),
" to pandas block with NumPy type ",
GetNumPyTypeName(NPY_TYPE));
}
return Status::OK();
}
Expand Down
17 changes: 17 additions & 0 deletions python/pyarrow/src/arrow/python/python_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "arrow/python/decimal.h"
#include "arrow/python/helpers.h"
#include "arrow/python/numpy_convert.h"
#include "arrow/python/numpy_internal.h"
#include "arrow/python/numpy_interop.h"
#include "arrow/python/python_test.h"
#include "arrow/python/python_to_arrow.h"
Expand Down Expand Up @@ -847,6 +848,21 @@ Status TestUpdateWithNaN() {
return Status::OK();
}

Status TestGetNumPyTypeName() {
ASSERT_EQ(GetNumPyTypeName(NPY_BOOL), "bool");
ASSERT_EQ(GetNumPyTypeName(NPY_INT8), "int8");
ASSERT_EQ(GetNumPyTypeName(NPY_INT16), "int16");
ASSERT_EQ(GetNumPyTypeName(NPY_INT32), "int32");
ASSERT_EQ(GetNumPyTypeName(NPY_INT64), "int64");
ASSERT_EQ(GetNumPyTypeName(NPY_UINT8), "uint8");
ASSERT_EQ(GetNumPyTypeName(NPY_UINT16), "uint16");
ASSERT_EQ(GetNumPyTypeName(NPY_UINT32), "uint32");
ASSERT_EQ(GetNumPyTypeName(NPY_UINT64), "uint64");
ASSERT_EQ(GetNumPyTypeName(NPY_FLOAT32), "float32");
ASSERT_EQ(GetNumPyTypeName(NPY_FLOAT64), "float64");
return Status::OK();
}

} // namespace

std::vector<TestCase> GetCppTestCases() {
Expand Down Expand Up @@ -886,6 +902,7 @@ std::vector<TestCase> GetCppTestCases() {
TestMixedPrecisionAndScaleSequenceConvert},
{"test_simple_inference", TestSimpleInference},
{"test_update_with_nan", TestUpdateWithNaN},
{"test_get_numpy_type_name", TestGetNumPyTypeName},
};
}

Expand Down
Loading