Instead of adding the explanations as a comment in the code block, you can also just put it in between the code examples (as long as there is a blank line before and after the code block, sphinx will recognize it as normal text). I think this will be more clear. Eg:
```
...
>>> df.isin([1, 3, 12, 'a'])
       A      B
0   True   True
1  False  False
2   True  False

When ``values`` is a dict:

>>> df = DataFrame({'A': [1, 2, 3], 'B': [1, 4, 7]})
>>> df.isin({'A': [1, 3], 'B': [4, 7, 12]}) 
...
````