1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Put all row from a data in a list

Discussão em 'Python' iniciado por Stack, Novembro 30, 2025.

  1. Stack

    Stack Membro Participativo

    I am having a problem to put an entire row from data in a list

    import pandas as pd
    import numpy as np
    import csv
    df= pd.read_csv ("data.csv")

    my_list = [] # list

    for n in range(1, len(df)): #entire data
    if df.loc[n].isin([1]).any() : # if a value 1 is found in any row
    my_list.append(df.loc[n:n]) # add the row in my_list


    I am trying to find a row where any value of that row has 1 ,then put the entire row in my_list . How can i add all the data from that row in a list and continue ?

    But its showing "unhashable type: 'Series'"

    Continue reading...

Compartilhe esta Página