Questions tagged as 'python'

1
answer

Read a list of lists in txt python 3

I have a list of very giant lists and it gets in the way of my code. So I wanted to save this list into a txt file and ask the algorithm to save this list into a new variable. Let's assume my list of lists is: [[[1],[2]],[[3],[4]]]...
asked by 25.08.2017 / 14:52
2
answers

How to compare if the contents of two string columns of a data frame are similar

I have a date frame where I need to compare how much the contents of two columns look like. For example: coluna a = “José Luiz da Silva” and coluna b = “José L. Silva” . How can I do to indicate that column a and column b are sim...
asked by 01.07.2017 / 03:42
3
answers

Next () in CSV Reader with Python 3

Hello, I'm doing a Machine Learning / Classification course and well it uses a CSV file in which one should ignore the first line of the file. Then I made the following code: import csv def carregar_acessos(): X = [] Y = [] arqui...
asked by 09.11.2017 / 01:00
1
answer

Importing specific modules is faster / more performative than importing everything (with the asterisk)?

In Python, since when I realized that it is possible to import specific functions or classes of a module, I have always chosen to do so. One of the reasons is readability. The other reason I'm not sure, so I wanted to get this question: performa...
asked by 09.11.2016 / 17:57
1
answer

How to remove part of a JSON file

I need to remove parts of a JSON, but I do not know how I can do it. I'm converting the same to CSV, and when I convert the structure it gets all weird Here is the print explaining better, which is marked in black, I need to remove it and...
asked by 05.10.2017 / 19:20
1
answer

Why is not working when comparing the replace of a string?

I tried to do in CLI Python 2.7.6 the following command: 'foo bar'.replace(" ", "") is 'foobar' But returned False Although 'foo bar'.replace(" ", "") return 'foobar' Does anyone have any logical explanation for t...
asked by 10.10.2016 / 05:41
1
answer

Real-time window update problem

Hello. I'm creating a program that allows the user to know which note they are singing and their respective frequency, in real time. However, during the update of the window, the program stops working and only refreshes after a few seconds, happ...
asked by 26.07.2016 / 04:54
1
answer

Problems with python code in file i / o

Hello, I am new to python, I'm programming in 3.5.1, I was doing a piece of code that reads and then draws a line from a file: lista = {} # Essa função lê o arquivo e divide ele em linhas, em palavras e depois coloca dentro de um dicionario...
asked by 09.07.2016 / 14:10
1
answer

Cell phone battery autonomy statistics in python

I have this data of the battery use of my cell phone that I captured using Tasker: 97 - 1467514184514 tela desligada - 1467514366535 tela ligada - 1467514369196 96 - 1467514414616 95 - 1467514674523 94 - 1467514924621 93 - 1467515154585 92 - 1...
asked by 03.07.2016 / 20:05
1
answer

Function to mount query from table and add array to function

I'm trying to create a function where I need to send to it an array that goes with the same data as the sequence of the insert in the database but I'm not having any idea how to send that array into the function and mount the insert array exa...
asked by 22.01.2017 / 01:20