Questions tagged as 'python'

1
answer

Error accessing parent class method [closed]

   Traceback (most recent call last): File   "C: /udemypy/Basic/classes/heranca/ex2/funcionario.py", line 20, in          print (gF.getBonification ()) File "C: /udemypy/Basic/classes/heranca/ex2/funcionario.py", line 16, in   getBonification   ...
asked by 19.09.2017 / 00:19
1
answer

Solutions counter in recursion

Hello, I did a recursive Sudoku program, it works fine, but I would like to add a solution counter, I have tested numerous code changes that would allow this, but it did not work, I finally tried a solution using global variables as I would imple...
asked by 18.09.2017 / 02:27
1
answer

Use the set and for function in the same structure

I'm studying data science through the Python language and I came across the following code: world_trends_set = set([trend['name'] for trend in world_trends[0]['trends']]) us_trends_set = set([trend['name'] for trend in us_trends[0]['trends']])...
asked by 28.07.2017 / 19:24
1
answer

Python / Pandas - How to remove extra space between two words in a column of the data frame

The "strip" function removes the spaces on the left and right, but does not remove the spaces between the words: raw_data = {'NAME': [' José Luiz da Silva ']} df = pd.DataFrame(raw_data, columns = ['NAME']) df['NAME'] = df['NAME'].str...
asked by 04.07.2017 / 16:16
3
answers

Generate random numbers and add them

I would like to be able to make the script generate " n " numbers (so far everything is done as you can see in the code below) and add them up. import random n = 2 total = (random.randint(1, 100), n) print total Now all you need to do is...
asked by 04.07.2017 / 18:46
1
answer

FFmpeg and video vs. audio time

I have a simple application that downloads a video + audio and 'concatenates' them with the tool FFmpeg , the problem is that most of the time the user will download a song bigger than the video in question and then there is a video of 10 secon...
asked by 05.07.2017 / 21:25
1
answer

Redirect to another page in the Django view

I'm learning Django now and the idea is this: I have a registration form with only the email, when this email is filled and the user clicks send, I need the view to go to the other page where the user will finish the registration, how do I do...
asked by 08.08.2017 / 14:35
1
answer

Format & End in print in Python

I am creating an application that connects to the Sqlite db, search and return the column of the table in question, the problem is that the result returned unformatted looks like this: ( u'Field 1, Field 2' ) , to print I tried to use...
asked by 01.07.2017 / 18:00
1
answer

Python / Pandas - How to compare if column content of the data frame, in date format, is equal to another column of date plus or minus 1 day?

I have a date frame with two columns in the date format and I need to compare if one of them is between the interval of one more day or less than another column. For example: Column A = 2015-03-02 Column B = 2015-03-01 Comparation: If Column A =...
asked by 13.07.2017 / 17:33
1
answer

Python 2.7: Program does not run [closed]

Hello, My program is no longer running, it used to work normally but then it just does not work. I checked that the program is no more than the "reload (sys)" line. # -*- coding: cp1252 -*- from gtts import gTTS as gtts import sys reload(sys);...
asked by 09.07.2017 / 17:01