diff --git a/python/pyarrow/table.pxi b/python/pyarrow/table.pxi index a035c0632fb8f..b65dac4cba4bb 100644 --- a/python/pyarrow/table.pxi +++ b/python/pyarrow/table.pxi @@ -1635,7 +1635,8 @@ def table(data, names=None, schema=None, metadata=None): "passing a pandas DataFrame") return Table.from_pandas(data, schema=schema) else: - return TypeError("Expected pandas DataFrame or python dictionary") + raise TypeError( + "Expected pandas DataFrame, python dictionary or list of arrays") def concat_tables(tables): diff --git a/python/pyarrow/tests/test_table.py b/python/pyarrow/tests/test_table.py index 499b2670f78b6..6fe7ba3baaac2 100644 --- a/python/pyarrow/tests/test_table.py +++ b/python/pyarrow/tests/test_table.py @@ -1183,6 +1183,11 @@ def test_table_factory_function_args_pandas(): assert table.column('a').type == pa.int32() +def test_table_factory_function_invalid_input(): + with pytest.raises(TypeError, match="Expected pandas DataFrame, python"): + pa.table("invalid input") + + def test_table_function_unicode_schema(): col_a = "äääh" col_b = "öööf"