1
Hello Please have a pandas.core.frame.Dataframe with these columns, in Python3:
Estado 150 non-null object
Cargo 150 non-null object
Nome_candidato 150 non-null object
CPF 150 non-null int64
Nome_urna 150 non-null object
Partido 150 non-null object
Situacao 150 non-null object
Avaliacao 130 non-null object
Projeto 150 non-null object
Link 72 non-null object
Autor_1 150 non-null object
Autor_1_limpo 150 non-null object
Autor_2 6 non-null object
Autor_2_limpo 6 non-null object
Autor_3 1 non-null object
Autor_3_limpo 1 non-null object
Autor_4 1 non-null object
Tipo 150 non-null object
Fonte 150 non-null object
I want to create a list only with the contents of the Project column. I did so:
projetos_eleitos = []
for i in autor1:
valor_projeto = i.Projeto
projetos_eleitos.append([valor_projeto])
With that mistake:
AttributeError Traceback (most recent call last)
<ipython-input-32-c6845dcc0293> in <module>()
1 for i in autor1:
----> 2 valor_projeto = i.Projeto
3 projetos_eleitos.append([valor_projeto])
4
AttributeError: 'str' object has no attribute 'Projeto'
Does anyone know what the mistake is?
The field
valor_projeto
expecting a String, there is some property that can be called after object Project? Ex:valor_projeto = i.Projeto.nome
or even perform a cast :valor_projeto = str(i.Projeto)
– Leandro Paixão
How is being defined
autor1
?– Woss
The error says:
i
is aString
and the objectString
has no attribute calledProjeto
. How is being definedautor1
?– Lacobus
Thank you all. Usei esse comando para pegar o conteúdo: valor_projeto = autor1.Projeto.tolist()
E autor1 estava definida assim: 
autor1 = pd.merge(eleitos_d_p, proj_isa, left_on='Nome_urna', right_on='Autor_1_limpo')
– Reinaldo Chaves