[Python] Checking duplicated by a part of the cell value

Discussão em 'Python' iniciado por Stack, Janeiro 21, 2025.

  1. Stack

    Stack Membro Participativo

    I have a df having a column df['tracker_name'] with such a data:


    pr:mfo|ch:paid_banner|cp:ep_hybe_mfo_ios|in:none|dt:28122024
    pr:mfo|ch:paid_banner|cp:ep_hybe_mfo_ios|in:none|dt:28112024
    pr:funds|ch:banner|in:none
    ch:banner|in:none
    pr:funds|ch:pr|in:none
    pr:vklady|ch:banner|pr:app|in:none|dt:30112024
    pr:brokers|ch:email|cp:start_invest_AKMM|in:none|dt:20012025
    pr:brokers|ch:email|cp:start_invest_BCSD|in:none|dt:20012025
    pr:vklady|ch:paid_banner|cp:ep_bidease_vklady_rustore|in:none|dt:20012025
    pr:vklady|ch:paid_banner|cp:ep_bidease_vklady_rustore|in:none|dt:17012025
    ​

    etc.

    I'm interested in checking duplicates with only part of the cell value, for example 15 simbols or multicondition like duplicated pr: and ch:.
    I want to see my answer like that:


    pr:mfo|ch:paid_banner|cp:ep_hybe_mfo_ios|in:none|dt:28122024
    pr:mfo|ch:paid_banner|cp:ep_hybe_mfo_ios|in:none|dt:28112024
    pr:brokers|ch:email|cp:start_invest_ AKMM|in:none|dt:20012025
    pr:brokers|ch:email|cp:start_invest_ BCSD|in:none|dt:20012025
    pr:vklady|ch:paid_banner|cp:ep_bidease_vklady_rustore|in:none|dt:20012025>
    pr:vklady|ch:paid_banner|cp:ep_bidease_vklady_rustore|in:none|dt:17012025
    pr:funds|ch:banner|in:none
    ch:banner|in:none
    ​

    Please share your thoughts, is that possible without parsing?

    Continue reading...

Compartilhe esta Página