You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/02/02 18:56:57 UTC
[GitHub] [arrow] jorisvandenbossche commented on a change in pull request #9386: ARROW-11373: [Python][Docs] Add example of specifying type for a column when reading csv file
jorisvandenbossche commented on a change in pull request #9386:
URL: https://github.com/apache/arrow/pull/9386#discussion_r568852511
##########
File path: docs/source/python/csv.rst
##########
@@ -75,7 +75,16 @@ 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`::
+
+ table = csv.read_csv('testdata.csv', convert_options=pa.csv.ConvertOptions(
+ column_types={
+ 's_name': pa.string(),
+ 's_start_date': pa.string(),
+ 'agg_percentile_bps': pa.decimal128(precision=38, scale=10),
+ }
+ ))
Review comment:
Specifically, you could maybe show to read the "total_bill" and "tip" columns as decimal?
----------------------------------------------------------------
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:
users@infra.apache.org