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



##########
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:
       And here's me testing the example executes without exception, and 
results in a table with `total_bill` &  `tip` casted to `decimal `:
   
   ```
   >>> from pyarrow import csv
   >>> import pyarrow as pa
   >>> table = csv.read_csv(
   ...     "tips.csv",
   ...     convert_options=pa.csv.ConvertOptions(
   ...         column_types={
   ...             "total_bill": pa.decimal128(precision=10, scale=2),
   ...             "tip": pa.decimal128(precision=10, scale=2),
   ...         }
   ...     ),
   ... )
   >>> print(table)
   pyarrow.Table
   total_bill: decimal(10, 2)
   tip: decimal(10, 2)
   sex: string
   smoker: string
   day: string
   time: string
   size: int64
   ```
   
   
   Note: It took me a while to find the dataset in question. Looks like it's in 
the pandas repo. A link to it from these docs would be nice.
   
   
https://raw.githubusercontent.com/pandas-dev/pandas/master/pandas/tests/io/data/csv/tips.csv




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