ls class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">import pandas as pd

from comchoice.aggregate.__set_rank import __set_rank
from comchoice.aggregate.__set_card_id import __set_card_id


def win_rate(
    df,
    alternative=&#34;alternative&#34;,
    alternative_a=&#34;alternative_a&#34;,
    alternative_b=&#34;alternative_b&#34;,
    selected=&#34;selected&#34;,
    show_rank=True,
    voter=&#34;voter&#34;,
    **kws
):

    df = __set_card_id(
        df.c