Questions tagged as 'python'

1
answer

NLPS parsing with external list

Parsing: An input text that will pass through the grammar and output are all entries that the grammar finds in the text. The problem is that my non-terminals are external list files and I can not visualize a way to do it. Example of a pseudo-...
asked by 31.08.2017 / 16:40
2
answers

Create list with column contents

Hello Please, I 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...
asked by 06.10.2017 / 16:12
1
answer

Findall using ElementTree does not return expected result

I'm trying to find a specific element inside a python XML file. To do this, I use ElementTree. The following code: root = ET.fromstring(response.content.decode('utf-8')) print(root.findall('.//*')) Give me the following table as...
asked by 18.09.2017 / 16:25
1
answer

Class polynomial - list assignment index out of range

I'm not sure how to do this, but I'm not sure how to do this.    File "/home/leticia/Documentos/python/Poo/polinomio.py", line 30, in          p3 = p1 + p2 File "/home/leticia/Documentos/python/Poo/polinomio.py", line 19, in    add       ind...
asked by 31.08.2017 / 18:44
2
answers

Error in deploy django / app in heroku?

I need your help to try to find the error in my deploy, which I'm trying to do in heroku. Follow bash information: (python3) user@Inspiron-5548:~/opt/anaconda3/envs/python3/Projetos/ecommerce$ heroku logs (python3) user@Inspiron-5548:~/opt/...
asked by 24.08.2017 / 18:06
1
answer

How to sum a column of a file and view it with .plot (kind = 'bar')?

I'm trying to sum the duration column, and display using plot() trip_data['duration'].value_counts().plot(kind = 'bar') trip_data['duration'].count_data().plot(kind = 'bar') trip_data['duration'].size().plot(kind = 'bar') But everyth...
asked by 15.09.2017 / 03:58
1
answer

How to change is_staff when I click on href?

I have a table with users in HTML with id and name, by default when registering a person it comes with is_staff = False. I want when I click the Authorize link change to is_staff = True, how do I do this in the view? {% block content %}...
asked by 14.09.2017 / 19:16
1
answer

Django - CPF Mask, DDD and phone number

I need to put a mask on entering the CPF, DDD and phone number. I'm a beginner in Python and Django and would like to know how I can display this mask at the time of typing: For the CPF: 999.999.999-99. For the Telephone: (99) 99999-9999....
asked by 26.08.2017 / 04:58
1
answer

Filter data from a string with regular expression [duplicate]

I have a variable that contains the full name of the company and the CNPJ. I'm using verificaCnpj = re.search("\d{2}.\d{3}.\d{3}/\d{4}-\d{2}", variavel) to locate the CNPJ (because there are other variables that DO NOT CONTAIN CNPJ, and t...
asked by 07.08.2017 / 16:34
1
answer

Questions about classes and methods in Python

I have a question, I can not do an exercise in classes and methods.    2 - Create the "Date" class with the attributes: day, month, and year. And create the methods "setarData (receive day, month and year)" and "print (" ex: 03/08/2017 ")". T...
asked by 04.08.2017 / 01:05