dianaclarke commented on a change in pull request #9386:
URL: https://github.com/apache/arrow/pull/9386#discussion_r579553038



##########
File path: docs/source/python/csv.rst
##########
@@ -75,7 +75,22 @@ Customized conversion
 ---------------------
 
 To alter how CSV data is converted to Arrow types and data, you should create
-a :class:`ConvertOptions` instance and pass it to :func:`read_csv`.
+a :class:`ConvertOptions` instance and pass it to :func:`read_csv`::
+   import pyarrow as pa

Review comment:
       Before and after screenshots of the rendering, if it helps with review. 
Note that if you black format the example (screenshot 3), it won't be truncated 
as it currently is in the AFTER screenshot.
   
   That said, with the arrow sphinx theme applied, your example isn't truncated 
(screenshot 4). Perhaps the core devs/reviewers have thoughts on how they want 
code examples to be formatted.
   
   Updated: The following alternative formatting passes Arrow's linting rules 
(`$ archery lint --python`). I would go with this formatting.
   
   ```
       table = csv.read_csv('tips.csv.gz', 
convert_options=pa.csv.ConvertOptions(
           column_types={
               'total_bill': pa.decimal128(precision=10, scale=2),
               'tip': pa.decimal128(precision=10, scale=2),
           }
       ))
   
   ```
   
   BEFORE:
   
   <img width="745" alt="Screen Shot 2021-02-19 at 5 19 31 PM" 
src="https://user-images.githubusercontent.com/878798/108575787-9ef08f80-72d8-11eb-927d-21cc07cf32e1.png";>
   
   AFTER:
   
   <img width="774" alt="Screen Shot 2021-02-19 at 5 18 21 PM" 
src="https://user-images.githubusercontent.com/878798/108575784-9c8e3580-72d8-11eb-91b7-426b9b570261.png";>
   
   BLACK FORMATTED: 
   
   <img width="787" alt="Screen Shot 2021-02-19 at 5 41 17 PM" 
src="https://user-images.githubusercontent.com/878798/108576268-2f7b9f80-72da-11eb-8f81-83fcb920722f.png";>
   
   WITH THEME:
   
   <img width="750" alt="Screen Shot 2021-02-19 at 6 17 49 PM" 
src="https://user-images.githubusercontent.com/878798/108577653-01e52500-72df-11eb-8191-387c51d70926.png";>
   
   




----------------------------------------------------------------
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.

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


Reply via email to