AlenkaF commented on a change in pull request #12543:
URL: https://github.com/apache/arrow/pull/12543#discussion_r830895572



##########
File path: python/pyarrow/_csv.pyx
##########
@@ -121,6 +121,59 @@ cdef class ReadOptions(_Weakrefable):
     encoding : str, optional (default 'utf8')
         The character encoding of the CSV data.  Columns that cannot
         decode using this encoding can still be read as Binary.
+
+    Example
+    -------
+
+    Defining an example file from bytes object:
+
+    >>> import io
+    >>> s = b'''1,2,3
+    ... Flamingo,2,2022-03-01
+    ... Horse,4,2022-03-02
+    ... Brittle stars,5,2022-03-03
+    ... Centipede,100,2022-03-04'''

Review comment:
       In this case the docstring of a a single-line string is printed 
correctly interactively (in IPython or Jupyter Notebook at least) and the lines 
are duplicated by calling `print()` which makes the whole example longer:
   
   ```python
       Examples
       --------
   
       Defining an example file from bytes object:
   
       >>> import io
       >>> s = b'''1,2,3
   Flamingo,2,2022-03-01
   Horse,4,2022-03-02
   Brittle stars,5,2022-03-03
   Centipede,100,2022-03-04'''
       >>> print(s.decode())
       1,2,3
       Flamingo,2,2022-03-01
       Horse,4,2022-03-02
       Brittle stars,5,2022-03-03
       Centipede,100,2022-03-04
   ```
   
   But if print is omitted, the example in html version is missing a better 
visual of the data. 
   
   I do not have a good idea what I would suggest at this moment, but will 
think about it and add ideas here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to