Posts by pitanga • 550 points
24 posts
-
1
votes1
answer57
viewsA: Select values from one column from other columns
The Flightid column does not exist, as described by the keyError KeyError: "None of [['FlightID']] are in the [columns]" You may have been mistaken in copying the column names here. Check your…
-
0
votes2
answers171
viewsQ: Coding problems
I’m having codage problem that I can’t solve. I’ve tried several suggested things but none works: Script: # -*- coding: utf-8 -*- import sys line = ["Oi tudo bem com você","eu GOSTO de café", "esta…
-
2
votes2
answers206
viewsQ: Replace words between two files
I’m trying to do some overwriting between two files: if a word from file 1 is in the second column of file 2, replace that word from file 1 with the word from the first column of file 2 File 1:…
-
2
votes2
answers1413
viewsQ: Remove blank lines in a csv
I am trying to remove empty lines from a csv document: Document: phrase, .,pt .,en .,en .,it .,es .,pt .,pt .,es .,pt .,pt "it’s not Expensive",en "casi 50 euros la alfombra es cara", " the price…
-
1
votes1
answer48
viewsQ: Find substring with REGEX
I am trying to turn all parts N_(...) into uppercase. I thought REGEX would be the most appropriate. It’s just too hard to even capture the N_(...) part and then turn it into capital letters I can…
-
2
votes3
answers3778
viewsQ: Count the most popular words
I’m trying to find the number of occurrences of a list of words in a text: from collections import Counter def popularidade (texto, palavras): texto = texto.lower().split() palavras =…
-
4
votes1
answer462
viewsQ: Search for disordered word sequence from a list in text
Is there any way to have a list of unordered words and look for if there is a sequence of them in a text? Example: lista = ["dia", "noite", "tarde", "é", "está", "bonito", "o", "a", "muito", "feio"]…
-
4
votes1
answer1498
viewsQ: Count how many times a word of a file appears in another file
I would like to count how many times a word list (archive1) appears in another word list (archive2) with open("corpus.txt", "r") as f1, open("lexico.txt", "r") as f2: file1 = f1.read() file2 =…
-
3
votes4
answers94
viewsQ: Putting elements in lists
I would like to have two lists: one with the name of the fruit and the other with the colors. lista = ['banana [amarela]\n', 'uva [vinho]\n', 'laranja [laranjado]\n', 'kiwi [verde]\n', 'framboesa…
-
3
votes1
answer649
viewsQ: Open multiple files with "with open"
It is possible to open more than one file in a program with with open("meutexto.txt", "r") as f: I didn’t find anything about it (or didn’t look hard enough). I know it’s possible to do otherwise:…
-
0
votes1
answer170
viewsQ: Parsing NLP with external list
Parsing: An input text that will go through grammar and output are all the inputs that grammar finds in the text. The problem is that my non-terminals are files from external lists and I can’t see a…
-
3
votes1
answer7534
viewsQ: Count elements of a column
How to count the number of occurrences in columns? Filing cabinet: luz NC luz mas ADV más blanquita ADJ blanco que CQUE que las ART el que CQUE que traía VLfin traer de PREP de serie NC serie mi PPO…
-
4
votes2
answers471
viewsQ: Theoretical doubt about while and indentation
count = 0 while (count < 10): # Ponto A print ("Olá...", count) count = count + 1 # Ponto B # Ponto C Why Count < 10 is always true at point B. is not true if the "Point B" belongs to the same…
-
1
votes2
answers1083
viewsQ: Sort a. csv file from the numeric column
I have the following file: es;548 la;1832 primera;35 vez;107 que;2598 hago;15 un;878 pedido;642 y;1713 creo;83 ha;207 funcionado;1 muy;371 bien;257 los;1054 precios;88 fuesen;11 And I’d like to sort…
-
1
votes0
answers114
views -
0
votes1
answer56
viewsQ: Error printing a single variable
I am unable to print an ultra simple code in Java. It shows the following error: Exception in thread "main" java.lang.Error: Unresolved Compilation problem: Cannot make a Static Reference to the…
-
2
votes1
answer50
viewsQ: Recognize loop for from other python scripts
I’m trying to write a python script that can recognize any boucle for in other python scripts. import re with open('boite_a_fonctions_v3_1.py', 'r') as f: text=f.read() a = text.split(" ") #print…
python-3.xasked pitanga 550 -
0
votes1
answer863
viewsQ: Lower() and strip() methods
print ("Escreva uma frase toda em maiúscula e sem espaços em branco") frase = input("Escreva uma frase: ") print (frase.lower()) print (frase.strip()) Upshot: Escreva uma frase toda em maiúscula e…
python-3.xasked pitanga 550 -
3
votes1
answer56
viewsQ: Difficulty with def and regex
I have the following list: support;auteur;titre;nombre_de_prets Bande dessinée jeunesse;Saint-Mars, Dominique de;Max et Lili ont volé des bonbons [Texte imprimé];1095 Livre jeunesse;Saint-Mars,…
python-3.xasked pitanga 550 -
0
votes2
answers1034
viewsQ: Nameerror: name 'input' is not defined
I don’t understand the error in this code... def checkio(number): #Your code here #It's main function. Don't remove this function #It's using for auto-testing and must return a result for check.…
-
0
votes1
answer5173
viewsQ: Taberror: inconsistent use of tabs and Spaces in indentation
I’m trying to write a script and only the first part works: import re with open('lista.csv', 'r') as f: primeira_linha = f.readline() #print(primeira_linha) outras_linhas = f.readlines()…
python-3.xasked pitanga 550 -
1
votes2
answers765
viewsQ: Typeerror: split() Missing 1 required positional argument: 'string'
One more basic question on my part. I am 'Pythonist' super basic level and I am simply trying to read a text line by line and make a split each time I find a punctuation mark or a space. I tried…
-
0
votes1
answer459
viewsQ: Wifi connection problems and to install git in Ubuntu 16.04
I am a new Ubuntu 16.04 Laptop (I started yesterday!!). My PC is dual-boot with Windows 10. I have two problems and I’m already a little desperate... 1) Wifi does not work (I type the password and…
-
0
votes1
answer3982
viewsQ: Error: "in module named xxxx"
I have Python installed on my Pcs (Windows 7 and 8) but I can’t run any script that contains import. Error message always appears: import error: no module named xxxx.…