Posts by Walt057 • 113 points
14 posts
-
1
votes1
answer174
viewsQ: Difference between Divide and Conquer, Decrease and Conquer and Dynamic Programming
What’s the difference between algorithm design techniques Divide and Conquer and Decrease and Conquer? To divide is recursive and the decrease nay? Some example for the decrease? And dynamic…
-
0
votes2
answers5301
viewsQ: Delete value from a Python dictionary
I need to delete a key from a dictionary if a certain situation arises. I have this code: for i in dict.keys(dataClean): dataClean[i] = dataClean[i] - 1 if dataClean[i] == 0: del…
-
0
votes1
answer77
viewsQ: separate special characters
I have a text file of this kind: Olá podes dizer-me quando o 1 passa aqui? ele passa, quando passar o Carlos Alberto. I need to in python Remove special characters such as punctuation, numbers,…
-
1
votes1
answer47
viewsQ: Nan of a csv file in D3.js
var margin = {top: 20, right: 10, bottom: 100, left: 40}; var width = 700 - margin.right - margin.left; var height = 500 - margin.top - margin.bottom; // o g para agrupar objetos juntos, agrupar as…
-
-1
votes1
answer1415
viewsQ: python stopwords
Is there any way stopword without using the import nlkt? I’m searching the web but I’m not finding another way. I can’t install the nltk in my 64-bit Python 3.6. I follow all the steps, but finished…
-
0
votes1
answer1386
viewsQ: Save words with python accents
I have this json file maker: {"certa": 1, "vez": 7, "quando": 13, "tinha": 6, "seis": 7, "anos": 6, "vi": 4, "num": 4, "livro": 3, "sobre": 6, "a": 47, "floresta": 1, "virgem": 1,…
-
0
votes2
answers1751
viewsQ: Medium, Minimum and Maximum in a python dictionary
I have a dictionary like that: {walt: 0.942342, disney: 0.324234, robert: 0.562354, help: 0.546912, ...} And I do it to find the average and the maximum: media =…
-
0
votes2
answers108
viewsQ: Order dictionary and display 20 first
I have a dictionary with words and their frequency. Of the kind: dic = {walt: 2, disney: 1, ola: 5, ...} To sort the dictionary I did so: aux = sorted(dicionario, key=dicionario.get, reverse=True)…
-
0
votes1
answer213
viewsQ: python Count of different words with only one counter?
I have this code: palavras = dataClean.split() count = 1 for palavra, frequencia in palavras: aleatorio = random.uniform(0.0, 1.0) if aleatorio < 0.5: count += 1 contProb[palavra] = count count =…
-
2
votes1
answer192
viewsQ: Sort dictionary and add python values
I have this text file that is processed to capitalize and this part does correctly. olá meu nome é meu nome pois eu olá é meu nome walt não disney olá Then I have this function which should be able…
-
0
votes2
answers414
viewsQ: Store a dictionary in a Python file
I have a function that counts how many times the words appear: def countWordExact(dataClean): count = {} dataFreq = [] for word in dataClean.split(" "): if word in count: count[word] += 1 else:…
-
2
votes1
answer1546
viewsQ: Remove score from a Python file
I have this code: dataClean = ''.join(data).lower() dataClean = re.sub(r'["-,.:@#?!&$]', ' ', dataClean) print(dataClean) Where data is an array of a text file. My goal is to remove punctuation,…
-
1
votes2
answers538
viewsQ: About the structure of the Sorted function, how does it work?
The instruction below is done as many times as the vector size sub. What is the result of this instruction? sorted(sub, key = lambda x : size(x) ) Where x are the values from 0 to 31 inclusive and…
-
-2
votes2
answers480
viewsQ: Display matrix in python
I have a matrix of n by n and use this part of the code to present it: for i in range(len(data)): for j in range(len(data[0])): print ((data[i][j])) Being data the matrix. But the output looks like…