You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/09/05 06:04:06 UTC

[GitHub] [spark] itholic commented on pull request #37739: [SPARK-40265][PS] Fix the inconsistent behavior for Index.intersection.

itholic commented on PR #37739:
URL: https://github.com/apache/spark/pull/37739#issuecomment-1236571566

   > what if the `psidx` itself is a `MultiIndex`?
   > 
   > ```
   > >>> psidx
   > Int64Index([1, 2, 3, 4], dtype='int64', name='Koalas')
   > >>> psidx.intersection([(1, 2), (3, 4)]).sort_values()
   > MultiIndex([], )
   > ```
   
   @zhengruifeng Seems like the `psidx` in your example is still using `Index` rather than `MultiIndex` ?
   
   Maybe do you mean:
   
   ```python
   >>> psmidx
   MultiIndex([(1, 2),
               (3, 4)],
              )
   >>> psmidx.intersection([(1, 2), (3, 4)]).sort_values()
   MultiIndex([(1, 2),
               (3, 4)],
              )
   ```
   
   ??
   
   In this case, it works same as pandas as below:
   
   ```python
   >>> psmidx.to_pandas().intersection([(1, 2), (3, 4)])
   MultiIndex([(1, 2),
               (3, 4)],
              )
   ```


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org