pearu opened a new issue, #54650:
URL: https://github.com/apache/arrow/issues/54650
### Describe the enhancement requested
CSV columns typed as `date32` or `date64` are parsed only from the ISO-8601
format, and `ConvertOptions.timestamp_parsers` applies only to timestamp
columns:
```python
import io
import pyarrow as pa
from pyarrow import csv
convert_options = csv.ConvertOptions(
column_types={"d": pa.date32()}, timestamp_parsers=["%m/%d/%Y"]
)
print(csv.read_csv(io.BytesIO(b"d\n03/15/2020\n"),
convert_options=convert_options))
```
```
pyarrow.lib.ArrowInvalid: In CSV column #0: CSV conversion error to
date32[day]: invalid value '03/15/2020'
```
The workaround is to read the column as a timestamp and cast it to a date. I
propose that date columns try `timestamp_parsers` after the ISO-8601 parser
fails, and take the date of the parsed timestamp, as a cast from timestamp to
date does.
An implementation exists in #50146, which is being refactored into smaller
PRs.
Part of #41488.
### Component(s)
C++, Python
--
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]