aandrestrumid opened a new issue, #49514:
URL: https://github.com/apache/arrow/issues/49514
### Describe the enhancement requested
There are currently pyarrow functions converting a `pa.date32()` to its year
/ month / day. But there isn't a function that does the invert, accepting a
year, a month and a day and returning a `pa.date32`.
The current work around involve either using python `datetime.date` (but it
is slow and the range is limited). Alternatively one can build a date string
from the component and parse it. But it's far from ideal
```
import pyarrow as pa
import pyarrow.compute as pc
table = pa.table({"year": [2024, 2025], "month": [3, 7], "day": [10, 4]})
date_str = pc.binary_join_element_wise(
pc.cast(table["year"], pa.string()),
pc.utf8_lpad(pc.cast(table["month"], pa.string()), 2, "0"),
pc.utf8_lpad(pc.cast(table["day"], pa.string()), 2, "0"),
"-"
)
dates = pc.cast(date_str, pa.date32())
```
### 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]