This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 8a8281f47b MINOR: [Docs][Python] Add example of not nullable type in 
Schema (#14926)
8a8281f47b is described below

commit 8a8281f47b52b60466b81b85dd4327398ab3baea
Author: martin-kokos <[email protected]>
AuthorDate: Thu Dec 15 03:00:22 2022 +0100

    MINOR: [Docs][Python] Add example of not nullable type in Schema (#14926)
    
    It took me a while to figure out from the docs how to use a not nullable 
type in a schema. The inclusion of strings "nullable", "not null" right on the 
Schema page makes it more easy to find.
    Example like this also makes it more clear the tuple Schema takes is 
shorthand version of Field.
    
    Authored-by: Martin Mokry <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 python/pyarrow/types.pxi | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/python/pyarrow/types.pxi b/python/pyarrow/types.pxi
index d771ac7351..dc74c121e6 100644
--- a/python/pyarrow/types.pxi
+++ b/python/pyarrow/types.pxi
@@ -3270,10 +3270,12 @@ def schema(fields, metadata=None):
     >>> import pyarrow as pa
     >>> pa.schema([
     ...     ('some_int', pa.int32()),
-    ...     ('some_string', pa.string())
+    ...     ('some_string', pa.string()),
+    ...     pa.field('some_required_string', pa.string(), nullable=False)
     ... ])
     some_int: int32
     some_string: string
+    some_required_string: string not null
     >>> pa.schema([
     ...     pa.field('some_int', pa.int32()),
     ...     pa.field('some_string', pa.string())

Reply via email to