diff --git a/python-package/lightgbm/basic.py b/python-package/lightgbm/basic.py index fe6fe0f47f45..31ae5182ee9e 100644 --- a/python-package/lightgbm/basic.py +++ b/python-package/lightgbm/basic.py @@ -2584,7 +2584,7 @@ def set_field( # 'init_score'. if _is_pyarrow_table(data): if field_name != "init_score": - raise ValueError("pyarrow table provided for field other than init_score") + raise ValueError(f"pyarrow tables are not supported for field '{field_name}'") data = pa_chunked_array([ chunk for array in data.columns for chunk in array.chunks # type: ignore ]) diff --git a/tests/python_package_test/test_arrow.py b/tests/python_package_test/test_arrow.py index 525d0f7fa04d..fd20df25dd87 100644 --- a/tests/python_package_test/test_arrow.py +++ b/tests/python_package_test/test_arrow.py @@ -251,5 +251,5 @@ def test_dataset_construct_init_scores_table(): dataset.construct() actual = dataset.get_init_score() - assert actual.dtype == np.float64 - assert actual.shape == (5, 3) + expected = init_scores.to_pandas().to_numpy().astype(np.float64) + np_assert_array_equal(expected, actual, strict=True)