Kodiologist opened a new issue, #34121:
URL: https://github.com/apache/arrow/issues/34121
### Describe the enhancement requested
```
import pyarrow as pa, pyarrow.compute as C
x = pyarrow.array(['2008-01-01', '2008-01-02', '2008-01-03'])
```
This works fine:
```
>>> C.strptime(x, format = '%Y-%m-%d', unit = 's').cast('date32[day]')
<pyarrow.lib.Date32Array object at 0x7fce3227c880>
[
2008-01-01,
2008-01-02,
2008-01-03
]
```
But this isn't allowed:
```
>>> C.strptime(x, format = '%Y-%m-%d', unit = 'day')
Traceback (most recent call last):
File "pyarrow/_compute.pyx", line 1515, in
pyarrow._compute._StrptimeOptions._set_options
KeyError: 'day'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/home/arferk01/.local/lib/python3.10/site-packages/pyarrow/compute.py", line
251, in wrapper
options = _handle_options(func_name, options_class, options,
File
"/home/arferk01/.local/lib/python3.10/site-packages/pyarrow/compute.py", line
214, in _handle_options
return options_class(*args, **kwargs)
File "pyarrow/_compute.pyx", line 1538, in
pyarrow._compute.StrptimeOptions.__init__
File "pyarrow/_compute.pyx", line 1519, in
pyarrow._compute._StrptimeOptions._set_options
File "pyarrow/_compute.pyx", line 619, in
pyarrow._compute._raise_invalid_function_option
ValueError: "day" is not a valid time unit
```
It seems wasteful to have to compute a full seconds-level POSIX timestamp
when the only thing you have and that you want is the date.
Related: #31254.
### Component(s)
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]