jorisvandenbossche commented on code in PR #14080:
URL: https://github.com/apache/arrow/pull/14080#discussion_r970737215
##########
python/pyarrow/pandas_compat.py:
##########
@@ -541,7 +541,7 @@ def dataframe_to_types(df, preserve_index, columns=None):
if _pandas_api.is_categorical(values):
type_ = pa.array(c, from_pandas=True).type
elif _pandas_api.is_extension_array_dtype(values):
- type_ = pa.array(c.head(0), from_pandas=True).type
+ type_ = pa.array(c[:0], from_pandas=True).type
Review Comment:
> I am thinking that we could maybe also use values[:0] instead?
But, that then will loose some information in case of tz-aware datetimes I
think.
Maybe a "dumb" `c.head(0) if isinstance(c, Series) else c[:0]` might be the
easiest after all.
--
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]