[Python] How to slice list made columns

Discussão em 'Python' iniciado por Stack, Julho 2, 2025.

  1. Stack

    Stack Membro Participativo

    Imagine, i have a column made by a bunch of of lists.

    Column A
    List A of userids
    List B of userids
    List C of userids
    List D of userids


    And i want to acess list A, through index. Normally, i would just do

    df['Column A'][0]


    End result should be:

    ['ELEMENT OF LIST A', 'ELEMENT OF LIST A']


    But i get a weird keyerror : 0. Any ideas on what i could do so i get that specific end result? I want to know that because i need to acess a list value according to the index of my loop.

    As asked here is the dict output of a single row. It was the best i could do considering the size of the suceding ones.

    {'Steps': {0: '1-Onboarding + Retorno'},
    'CampaignSource': {0: 'abd-ecomm-sms'},
    'UserId': {0: [
    '07cf01d5-5179-4fa2-b3a1-a341cfa11625@tunnel.msging.net',
    '11f214d8-45dc-46d6-a9ae-8ae08a42cd7c@tunnel.msging.net',
    '2d24e127-a956-4946-af1f-47341761074b@tunnel.msging.net']}}

    Continue reading...

Compartilhe esta Página