Most voted "python" questions
Python is a dynamic and heavily typed programming language whose design philosophy emphasizes usability. Two similar but incompatible versions of Python are in use (2 and 3). Please mention the version you are using when asking a question about Python.
Learn more…8,642 questions
Sort by count of
-
0
votes2
answers280
viewsReplace use of dataframe with pandas . apply
I have a function that iterates a spreadsheet, which makes some controls. I looked over and saw about . apply, but I couldn’t implode. I would like to know if you could in that case, replace the use…
-
0
votes2
answers346
viewsIs it possible to run a python script that is in another directory?
I have a python script "dad": # Executar script de outra pasta if __name__ == '__main__': cmd = "main.py -username abcd -password 1234" subprocess.call(cmd, Shell=True) Which calls the script "son"…
pythonasked 4 years, 2 months ago Rony Deikson Santana 55 -
0
votes1
answer83
viewsComplete values in a table, with values of the table itself?
I have the table data ativo valor ajuste arquivo 17/07/2020 teste1 4,35 nan 9032800000190015197.txt 16/07/2020 teste1 nan nan 9032800000190015197.txt 15/07/2020 teste1 3,12 nan…
-
0
votes1
answer394
viewsHow to put an image in the background using the "Pysimplegui" library?
The Code I tried to use to put the image , but I could not : [sg.Image(r"C:\Users\Josiene\Desktop\Criptografia1.png")], And that’s all the code : import PySimpleGUI as sg sg.theme('Dark') layout = […
pythonasked 4 years, 2 months ago Deregue pinto 1 -
0
votes0
answers42
viewsSQL syntax error - Python
I have a flask application in which one of the features (log_request) is to record data from a form in an SQL database. When running def log_request, however, I have an error accusing incorrect…
-
0
votes2
answers174
viewsHow to create class correctly with pandas by applying methods?
I have a 'data.csv' file, with the data below: turma,nome,code,motivo,atividade,trofeus,data 9º Ano Fundamental A,Maria Joana,9X4YK,Realizar atividade Astromaker,Lição A,3,21/02/2020 11:44:11 9º Ano…
-
0
votes0
answers91
viewsPython - Function and Variable Problem
Well, I’m doing an old game project in Python, but in VS Code is giving an error in the print of an unused function and variable. First the function error, I’m using the library Colorama which, I…
pythonasked 4 years, 2 months ago Gustavo Franco 1 -
0
votes0
answers12
viewsHow to deploy code that uses Dryscrape in Heroku? (No such file or directory: 'src/webkit_server')
I’m not being able to push my app on Heroku. My application uses the library Dryscrape, and when I deploy to the Heroku app I get the following error: sh: 1: qmake: not found error: [Errno 2] No…
-
0
votes1
answer53
viewsReceive and read a json with list inside, python
Good afternoon, I’m using the reqparse library, but I don’t know if it works I’m getting a json like this: { "boletoPago": [ { "numero_boleto" : 23564754, "valor_pago" : 350.00, "data_pagamento" :…
pythonasked 4 years, 2 months ago Gabriel Ramos 1 -
0
votes1
answer39
viewsWhy does the background color of my Frame not change during the execution of my application in Tkinter, even with the setting of the bg parameter?
from tkinter import * class Teste(object): def __init__(self): mestre = Tk() mestre.title("Aplicação de teste") mestre.geometry("400x400") mestre.resizable(False, False) #Frames self.frame1 =…
-
0
votes3
answers52
viewsHow to fill out a list?
I need to fill out a list (without using packages like numpy or pandas) that has a format similar to the following: lista1 = [0, 3, 7, 10, 15] The numbers are increasing but do not follow an order…
-
0
votes1
answer33
viewsProblems using Graphapi in Python - "there is no Graphapi attribute in the Facebook Module"?
Hello, so, as the title suggests, I’m trying to use graphAPI facebook but without success, my goal is to do data mining for data science, but I’m not having much success, I’m following the…
-
0
votes0
answers172
viewsError: Attributeerror: 'Nonetype' Object has no attribute 'write'
I performed some operations on a dataframe by the pandas but I need to keep some cells of an xlsx with a formula. For this I imported a library xlsxwriter but I am not able to evolve my script…
-
0
votes1
answer89
viewsFormatting a dictionary using regex, based on a large database
Let’s say I have a following sample from a more extensive database. 146.204.224.152 - feest6811 [21/Jun/2019:15:45:24 -0700] "POST /incentivize HTTP/1.1" 302 4622 197.109.77.178 - kertzmann3129…
-
0
votes0
answers126
viewsHow to recognize images using python, cv2, Pillow and Tesseract?
I’m trying to recognize the images below, but I’m not able to abstract the content correctly. A few examples: Code import numpy as np import cv2 import mahotas import pytesseract as ocr from PIL…
-
0
votes0
answers36
viewsI’m having trouble segmenting an image
I’m creating a mix of image segmentation by k-Means and Spectral clustering, but I have a big problem at the end. I’ll leave the code here: import cv2 import timeit import time import numpy as np…
-
0
votes0
answers117
viewsAccess another python file method
I have a very simple code that clicks on an image on the screen: from src.imagesearch.functions import clickwithwait class Home: def clickNEWS(self): NEWS = r"..\NEWS.png" clickwithwait(NEWS) This…
-
0
votes0
answers206
viewsshow more Abels(xticks) on x-axis in Pandas/Pyplot charts
Hello I have this data in a CSV file (here only two lines were written, but the real file has several). Ano;Mes;Valor;Qtde;Tipo 2013;01;3982168388.81;562405;C 2014;01;4332471647.33;570833;C When I…
-
0
votes1
answer340
viewsWindow automatically closing Pysimplegui
I’m having a problem with Pysimplegui. The program is returning the correct value in the output, but when I click the button for the program to do the calculations it closes the window very quickly…
-
0
votes2
answers151
viewsHow to simplify this code in Python?
I am learning Python and I came across an exercise that called for the creation of a group() function that would divide the elements of a list into smaller lists according to predetermined size,…
pythonasked 4 years, 2 months ago João Guilherme Ferreira 31 -
0
votes1
answer44
viewsCount based on the value of a field and index filter in Elasticsearch with Elasticsearch-dsl
I’m using Python3.6, with elasticsearch (7.9.1) and elasticsearch-dsl (7.3.0). On my index logstash-2020.09.21 i have some documents as below (filtered by the relevant fields): { "subtype":…
-
0
votes1
answer278
viewsRelate two Dataframes in pandas and return value in python
I have two Dataframes, both in csv that import in pandas, one with the history of protocol records and one with a list of people authorized to make changes in the records of procotolos. How can I…
-
0
votes1
answer35
viewsHow to build a kernel size for an opencv Medianblur filter
I have this Medianblur filter in opencv: import cv2 img = cv2.imread('Resources/land.jpg') imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) def empty(a): pass # ------- CREATE TRACKBAR -------…
-
0
votes1
answer49
viewsHow do I import the missing library? Google Calendar Python API
I’m trying to insert events in Google calendar, via Python script, but I think a library is missing, because when I run the script the following error appears name error named 'service' is not…
-
0
votes1
answer33
viewsFind photo in Drive
I created a Google Forms form where I upload a photo, and I have another field where people describe the photo. The idea is to take this description and insert it into the photo description…
-
0
votes3
answers510
viewsUse Selenium without opening browser
How to use Selenium without opening the browser? I used a code I saw right here, options.add_argument("--headless"), and also options.set_headless(True), but makes that mistake:…
-
0
votes1
answer110
viewsExecution error in cx_Freeze
I am trying to make an executable of a script that I did where the program performs, in summary, the following tasks: 1 - Receives input from the operator 2 - Create some folders based on the…
-
0
votes1
answer44
viewsMatplotlib library problem (Python)
I am learning python and am making a program that generates graphics from a CSV file, but every time I try to use the function savefig(), it saves the data with the Labels of the previous ones,…
-
0
votes0
answers33
viewshow to send a form that the user has filled in to my email with python kivy?
My goal is that the form filled by the user send me an email with the fields filled, when the user click 'complete registration' My file.py class Cadastro(Screen): def pop(self): box =…
-
0
votes0
answers77
viewsnumpy.core. _exceptions.Ufunctypeerror: ufunc 'add' Did not contain a loop with Signature matching types (dtype('<U38')
i am starting in python and for my first 'big project' I decided to create a program that encrypts, with double key, a message according to the character indexes in an ascii character list. but when…
-
0
votes1
answer159
viewsHow do I let the user decide which variable he wants to change in python?
I am developing a framework, in the directory where it is located there is a folder called "Plugins" inside it is the modules that the user can import inside the framework using the command "use",…
-
0
votes1
answer228
viewsPage not found(404) - polls views Django tutorial
I’m doing the Django documentation tutorial in part 3 (https://docs.djangoproject.com/en/3.1/intro/tutorial03/) where it is said after adding some codes the following: "Take a look in your browser,…
-
0
votes1
answer249
viewsDjango - Filter queryset into a form using a value present in the view
I am creating this site where the first step of the user is to create the company he works for: ''''models.py''' class Empresa(models.Model): cnpj = models.CharField(unique=True, max_length=20,…
-
0
votes0
answers37
viewsHow to make a Function in Pygame show a texture?
We want to make a kind of Menu that contains a tutorial of the game that will appear on the top of the stage at the beginning and when the player presses the help button, but we cannot make this…
-
0
votes1
answer202
viewsHow to generate a horizontal multiple graph using python
Good afternoon, I’m doing a job for the college where I need to generate a multiple graph in horizontal bars. I’m using the following code: df_escolaridade['Espacialidades'] =…
-
0
votes1
answer289
viewsHow to remove an excerpt from a specific text in a PDF with Python
Hello, I need to extract a specific snippet from a PDF. The idea is to find the state registrations that were downloaded in the official journal of the state where I live, this is for the collection…
-
0
votes1
answer121
viewsPython error 535, Incorrect Authentication date for sending email (Solved)
Good morning, my application already hosted and running until last week, began to present this error: 535, 'Incorrect Authentication data' at the time the e-mail is requested. At first glance I…
-
0
votes0
answers41
viewsHow to create a single file that stores the details of the generated information (order)?
have_discount = [] no_discount = [] for each_price in purchases_prices: b = bool_gen(p) if b: have_discount.append(apply_discount(each_price,b)) have_discount = [round(each_price, 2) for each_price…
-
0
votes1
answer66
viewsWhat could I do for that except not to interrupt my Else?
This is my line of codes, I wish this except didn’t interfere in my last This, but in all the ways that I tried, went wrong. #frameworks usados import pandas as pd from pandas import DataFrame…
-
0
votes0
answers33
viewsWhere and how to access the files that are created within Cloud Functions?
I am currently using the Google Cloud Platform for a project, in this project I will use a media link from google Storage, with this mp4 media I will transform it into mp3 and "re-uple" for Storage…
-
0
votes1
answer74
viewsPython - How to get the date of the last Google Spreasheets update?
Personal talk! Next, I needed to check if there were any updates to the Google Spreasheets shared document. I thought I’d bring this field: as a date or as a timestamp in python and check with the…
-
0
votes1
answer53
viewsFilter Dataset from a groupby
I have the following dataframe (df_reviews) and need to remove the App versions that were downloaded less than 10 times and tried to do the steps below and a for to perform the filter on the…
-
0
votes2
answers66
viewsPython - Create dynamic variable for firebase
I have a code that you receive from a spreadsheet CodProduto, Descrição and Quantidade and then inserts them into the database. Only it does this 1000x looping. How can I create variables with this…
-
0
votes0
answers17
viewsAbout Pygame, I need a picture to get smaller and soon dps return to their normal size, cm a button being pressed for example
My main problem is that when I create a function to get the image back to normal size, instead of it shrinking back to normal, it simply skips the step of shrinking the image. (it does not have the…
-
0
votes1
answer268
viewsInserting in a python sqlite3 database by a class
I am doing a mini project of a registration in a database sqlite3 by python, my problem is that in my method, which registers the product with (id, name, purchase price, sale price, quantity), gives…
-
0
votes1
answer64
viewsERROR 10043 - Protocol not configured in system
Hello! I’m trying to create a script that monitors the network, I’m trying to learn so if there’s something wrong I’m sorry. The code I have import socket import struct import binascii s =…
-
0
votes1
answer54
viewsShow UTC time in an Entry Widget
I would like and was trying a way to show the time by updating myself, through an entry on Tkinter. I set up a function for this but I can’t get it to appear in Entry, instead it appears "Function…
-
0
votes2
answers52
viewsI have the following problem on my tuple
def convertFarenheit(n): return (n * (9/5)) + 32 def convertCelsius(n): return (n - 32) * (5/9) def graus(temp1,escala1,temp2,escala2): dados = () if escala1 == 'C' and escala2 == 'C': soma = temp1…
-
0
votes1
answer33
viewsAttach only one line to a CSV file with pandas
I am making a login system using very basic csv tables, because it is not the purpose of the program. def criar_conta(self, respostas): framelogin = pd.read_csv('C:\TCC\Aplicacao\Arquivos…
-
0
votes1
answer58
viewsElasticsearch server connection
Good afternoon! I’m trying to connect in Elasticsearch, but I’m not getting, I don’t know if I need to inform anything else in class es=Elasticsearch(..) # Import Elasticsearch package from…