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/10/21 10:56:17 UTC

[GitHub] [arrow] anmyachev opened a new issue #11500: pyarrow: read_feather failed when using pandas.Index as `columns` parameter

anmyachev opened a new issue #11500:
URL: https://github.com/apache/arrow/issues/11500


   `pandas.Index` is not a supported type or it's a bug?
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] jorisvandenbossche commented on issue #11500: pyarrow: read_feather failed when using pandas.Index as `columns` parameter

Posted by GitBox <gi...@apache.org>.
jorisvandenbossche commented on issue #11500:
URL: https://github.com/apache/arrow/issues/11500#issuecomment-949401194


   I think the most important would be to have consistency. But if we have some APIs that are currently strict on requiring a list, and others loose on requiring any iterable, then there are two options: make everything strict, or fix those cases that are now strict to have them work with any iterable. 
   But to me it would also feel strange to start adding strict `isinstance(.., list)` checks in several places that currently are perfectly fine with accepting a numpy array or any iterable ...


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] jorisvandenbossche commented on issue #11500: pyarrow: read_feather failed when using pandas.Index as `columns` parameter

Posted by GitBox <gi...@apache.org>.
jorisvandenbossche commented on issue #11500:
URL: https://github.com/apache/arrow/issues/11500#issuecomment-949397673


   On the other hand, supporting numpy arrays for those kind of arguments that expect a list is also relatively easy. We have quite some other methods that document a certain argument as list, while still accepting a numpy array (because in most cases we just rely on 1) length check and 2) iteration through the values).


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] amol- commented on issue #11500: pyarrow: read_feather failed when using pandas.Index as `columns` parameter

Posted by GitBox <gi...@apache.org>.
amol- commented on issue #11500:
URL: https://github.com/apache/arrow/issues/11500#issuecomment-948622669


   According to the `read_feather` documentation it accepts any sequence type ( https://arrow.apache.org/docs/python/generated/pyarrow.feather.read_feather.html ) so not strictly lists, but also tuples etc... As far as they contain `int` or `str`.
   
   While a `pandas.Index` adheres to the sequence protocol it provides custom implementation of many methods you would expect in a container. I personally think that supporting all possible implementations of classes that adheres to sequence protocol even when they are heavily custom is probably out of scope, so I would personally change the docstring to mention `list|tuple` and avoid confusion.
   
   Implementing support for `pandas.Index` is fairly quick but that would probably end up casting the index to a tuple or list if we want to keep the code generic. And that would mean introducing an extra cost that the user doesn't know it's paying when invoking that method. I guess it's more reasonable to make that cost explicit and have user cast to list or tuple


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] westonpace commented on issue #11500: pyarrow: read_feather failed when using pandas.Index as `columns` parameter

Posted by GitBox <gi...@apache.org>.
westonpace commented on issue #11500:
URL: https://github.com/apache/arrow/issues/11500#issuecomment-962373144


   ARROW-14621


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] westonpace commented on issue #11500: pyarrow: read_feather failed when using pandas.Index as `columns` parameter

Posted by GitBox <gi...@apache.org>.
westonpace commented on issue #11500:
URL: https://github.com/apache/arrow/issues/11500#issuecomment-949095282


   Technically the sequence protocol does not define equality.  The problem seems to originate from the line `sorted(set(columns)) == columns`.  We are relying on `list == sequence => bool` which is not valid when the sequence is a numpy array (`list == np.ndarray => np.ndarray`).
   
   The [correct method for comparing sequences](https://stackoverflow.com/questions/900420/elegant-way-to-compare-sequences) seems to be converting both sides to list or using imap (although given we are already doing `sorted(set(columns))` I think imap would be overkill).
   
   I'm in favor of @amol- 's general point though.  Changing the docs to mention `list|tuple` is probably a good solution.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] emkornfield commented on issue #11500: pyarrow: read_feather failed when using pandas.Index as `columns` parameter

Posted by GitBox <gi...@apache.org>.
emkornfield commented on issue #11500:
URL: https://github.com/apache/arrow/issues/11500#issuecomment-962291012


   Should we open up a JIRA to close this out?


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] westonpace closed issue #11500: pyarrow: read_feather failed when using pandas.Index as `columns` parameter

Posted by GitBox <gi...@apache.org>.
westonpace closed issue #11500:
URL: https://github.com/apache/arrow/issues/11500


   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org