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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to