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
votes0
answers24
viewsPython - Scrapy - Return nested Json (Json’s List)
Hello, I’m having a problem generating a dictionary answer within another dictionary. I have a home page that contains 8 bimonthly programs, in these picked up their respective links and properties.…
-
0
votes0
answers56
viewsKnow the radius of the circle using the python cv2 library
I need to find the radius of the circle using the cv2 library, I have the following code: What he does is circle where he finds circles within the parameters I set, now I want to know the radius of…
-
0
votes1
answer123
viewsValidate csv file in Django
I am trying to insert a function to validate the upload of a . csv, but when placing it the following error was presented: ImportError: cannot import name 'PresencaProf' from partially initialized…
-
0
votes1
answer53
viewsBring bank result and put in a list to use with variables
I’m working with Python 3.7. I am trying to define variables with data from a list[], the values of the list[] is a result coming from the database, but is giving error. Code: conn =…
-
0
votes0
answers59
viewsnp.savetxt No download file CSV(Jupyter Notebook)
I developed a code to help me analyze data faster than I’ve been doing before. All the development was adapted to Jupyter Notebook used in Google Chrome, this because the company I work does not…
-
0
votes0
answers28
viewsValidate upload by csv only
I have a small form where I ask the user to insert a csv file, however if the user inserts a file with different format he simply lets it pass. I’ve tried everything, but I’m not getting it done.…
-
0
votes0
answers13
viewsHow to show additional options after filling a Selection box in Django Admin
When trying to register in Django Admin I have three fields to fill out being them tipo_remuneracao valor and valor_max, however depending on the type of compensation I may need to show value and…
-
0
votes0
answers205
viewsHow to make a Python script run a Click on Windows 10?
I’m trying a simple script with python, it click on a screen coordinate. I have tried with Pyautogui, pynput, pydirectinput, pywinauto... But in none of them the click is actually done, the only…
-
0
votes1
answer53
viewsHow to change formularies in different modules
I’m using Python 3.7 I have 2 forms (windows) that I made with Pyqt5, in one of them have some Labels that I need to change according to the settings window configuration. created a modules with the…
-
0
votes0
answers34
viewsWith the removal reflection of a red image (opencv)
I am working on an image and I want to separate the white part (marbling) from the red part (meat), but in the image there is noise, nothing more than reflections on the image. I managed to apply…
-
0
votes2
answers43
viewsmove data left in pandas
import pandas as pd import numpy as np import matplotlib.pyplot as plt from unicodedata import normalize tabelas =…
-
0
votes1
answer38
viewsHow do I convert string values or items from an object column into binary with pandas?
I’m trying to convert a column into a data set where there is 'negative' and 'positive' for binaries or numeric items like 0 and 1, but I don’t know if I’m doing it right with the Pandas library.…
-
0
votes1
answer37
viewsValidate upload of csv files
I have a form that one of the fields asks for a file. The point is that only files . csv should be allowed, but I’m not getting the validation. Follow the code below with my last attempt. Filing…
-
0
votes0
answers34
viewsSelenium error while loading specific "Selenium Failed to resolve address" page
I am creating a python bot and when loading a page it shows in the console the following errors however it continues running however when I will try to execute anything involving the page it hangs…
python selenium selenium-webdriver web-scraping webdriverasked 3 years, 9 months ago OlopesMaster 1 -
0
votes0
answers17
viewsIsolation Forest with Cross Validation
how can I use a One Class classifier, such as Isolation Forest, with Cross Validation? I’m trying to do it this way: columns = data.columns.tolist() columns = [c for c in columns if c not in…
-
0
votes1
answer60
viewsPython3: Error in function that has dictionary
I have this code giving error in the assignment of the variable M, of the dictionary. Returning the next: NameError: name 'm' is not defined I’m a beginner in this kind of subject. The object of it…
pythonasked 3 years, 9 months ago Daniel Alves de Barros 21 -
0
votes1
answer120
viewsError connecting to SQL Server using pyodbc
I am trying to connect to SQL Server database using pyodbc lib in Python, but I am encountering error right from the start. Follow the code and error below. Script: import pyodbc conn =…
-
0
votes0
answers19
viewsHow I convert a keylogger to exe
Guys, I’ve been trying for a while to convert my program to exe, I’ve used several ways to do this, so far all gave errors. My code works perfectly in python but in exe it always returns an error. I…
-
0
votes0
answers30
viewsAutomation error in Selenium: Failed to change window status to 'normal'
When trying to execute a code using the Selenium library, I get the following error: <html><head></head><body></body></html> Traceback (most recent call last):…
python python-3.x selenium selenium-webdriver automationasked 3 years, 9 months ago Lucas Palmeira 13 -
0
votes0
answers32
viewsError relating tables in Sqlalchemy
I have two classes mapped: User and Contact with one-to-many relationship (User.). from sqlalchemy import Column, ForeignKey, Integer, String, UniqueConstraint from sqlalchemy.orm import…
-
0
votes1
answer66
viewsFilter a header inside df in pandas
I’m new to pandas and I’m having a hard time. I need to filter the columns in my dataframe, check if they are in a defined list and, if they are, group the columns and add up the values. It sounds…
-
0
votes0
answers16
viewsHow to use the session (cookie) of another site that was not set by flask
I wonder if there is a way to use a cookie set by another site, in my application in flask with python. I need to authenticate on a site that requires the A3 token, but I can’t capture this token…
-
0
votes1
answer34
viewsHow to format money fields in Django?
I have a field in my admin Django that receives a real value, but I would like that value to be formatted and not receive more than two decimal places. I tried using a javascript to modify the…
-
0
votes1
answer203
viewserror while opening . csv file with/ python/ pandas
I am new to the language and I am using Python 3 in jupternotebook inside anaconda. I followed the steps below. But it’s making a mistake I can’t decipher, please help me setting the work directory…
-
0
votes0
answers74
viewsAnd python how to stop a specific thread (or all) in while loop
How to stop one, or all threads in python by ID (example) I’m developing a program that should run some loops looking for information in real time. However, when any of them find something the…
-
0
votes0
answers44
viewsWhy does the comma disappear when converting an HTML to str in Python?
I’m extracting some data from a scraping page following a tutorial I saw on Youtube. Follow the code: import requests import pandas as pd from bs4 import BeautifulSoup from selenium import webdriver…
-
0
votes0
answers55
viewsAutomation with Selenium Webdriver Python
I’m doing an automation. where I access one page to be able to go to another, after going to another page I try to click on an element, but even using Webdriverwait is showing that it was not found…
-
0
votes1
answer366
viewsCompound interest in Python using "while"
Recently I was trying to solve an exercise to learn Python, but I found big problems when I tried to calculate compound interest. I used the mathematical formula of the amount and simply I have no…
-
0
votes1
answer75
viewsHow to make string substitutions from large-scale tuple indexes?
I need to find the index of some words in a string, store these indexes and, from them, perform other substitutions based on tuple indexes, which signal which words should be replaced and where they…
-
0
votes1
answer43
viewsI have a problem in the relation between two tables in Sqlite using python/Django
I am making a simple CRUD, using 2 tables, the default user of Django and the citizen I created, I am using a foreinkey username to link the two, but in the form, instead of appearing a username…
-
0
votes2
answers41
viewsHow to extract specific value from received message via Websocket?
I’m trying to extract the "balance" from a JSON. I would like to know how I can do this in a direct way, without receiving this complete message, which ends up being giant, but rather extract only…
-
0
votes0
answers70
viewsWould anyone like to explain why this came up"Exception has occurred: Missing optional dependency import 'xlrd'"?
I’m using vscode to use pandas in python My code from IPython.display import display import pandas as pd df = pd.read_excel(r"Vendas.xlsx") display(df) and I got this information on the line of "df…
-
0
votes1
answer40
viewsHow to define my package name in Pypi?
I am creating a python module to distribute in pypi, I am studying the process of creating distribution of modules by some tutorials and the pypi guide itself, but even so I still have some doubts.…
-
0
votes1
answer142
viewsDoubt Column Label - Seaborn Python
I have a Doubt when Plotting a chart in Seaborn, where the label of the Axis of Column is very large However, I would like to "break" this line in 2, or 3 Lines, to get smaller the label box and…
-
0
votes0
answers22
viewsMy Node JS API, which uses a Child process, works when run by nodemon, cmd but in PM2 generates error
My API runs a python script through an Express route, using Child process, I have tried to run only the script using python nameScript and it worked, I do not know why is giving this Python ENOENT…
-
0
votes1
answer56
viewsthe program does not read the file line it should read
i am making a program q reads a specific line from a.txt file so that I can then separate the line and get the information. i did this function to know on which line the CPF that was typed is…
pythonasked 3 years, 8 months ago user220443 -
0
votes1
answer112
viewsHow to shuffle all letters of words within a file . txt
I am creating a program that shuffles all the letters of the words inside a file . txt in which each line there is only one word. Example of a . txt (which I called Wordlist.txt): batata limonada…
-
0
votes0
answers26
viewsCommunication between console of two programs - Python
Good night Need to do through python communication between two programs, the second does not need to be in python, as it is just an example I have the following code print('Qual seu nome?') x =…
-
0
votes1
answer42
viewsPython Beautifulsoup remove tag within tag
I’m having a problem while making a Scrap of a page and capturing text. Basically the beginning of my code is as follows: url0 =…
-
0
votes1
answer60
viewsHow to use Selenium to select a specific tag with a class common to other tags?
I’m wanting to make Crapping the most up-to-date data of this page. Every day she makes available the data of the current day and the next day. My main interest is in the data of the next day. When…
-
0
votes1
answer31
viewsFailed to run a Python file
I want to make this executable code to use it in crontab: import data import mensagem from skpy import Skype sk = Skype(data.USERNAME, data.PASSWORD) def post_message_group(mensage, channel_id):…
pythonasked 3 years, 8 months ago user219931 -
0
votes0
answers27
viewsPython - Does not work from for
import os, sys, string # coding: utf-8 from typing import TextIO lista: TextIO = open("C:\\Users\\Eunice\\Desktop\\contas.txt", "r", encoding="utf-8") print(lista.readlines()) linha =…
-
0
votes1
answer59
viewswhen trying to create a bank with flask_sqlalchemy Attributeerror: can’t set attribute
Making a Flask app, I had some difficulties with the database, and followed the following steps in VSCODE: I created a virtual environment, installed via Pip flask and other libs I created the first…
-
0
votes1
answer15
viewsHow to put the validation rule only when saving and not validating in the update in Django admin with python?
I am developing in Django the following application of course management, in the register of a class I have a registration informing the amount of vacancies for doctors and academics, and in the…
-
0
votes0
answers59
viewsNoreversematch in Django
Hello I have a problem in Django that cannot solve a url with parameter (Django.urls.exceptions.Noreversematch: Reverse for 'incluNaRota' with Arguments '(',)' not found. 1 Pattern(s) tried:…
-
0
votes0
answers22
viewsRequests library not working on Instagram analysis tool on Google Collab
I am developing a very simple tool to simply collect the number of followers of Instagram accounts. I am doing by Google Collab since the company I work imposes several security restrictions when it…
-
0
votes1
answer40
viewsHow to prevent Python from considering very close numbers equal?
I made this algorithm to test how Python compares nearby numbers: x = 2.5 # número arbitrário que escolhi para fazer os testes y = float(input('Insira o Y ')) # print('X > Y = {}'.format(x >…
-
0
votes2
answers72
viewsLogic (if,Elif,Else) with python error
Code: def get_status(df3): if (str(df3['Forecast RELEX']).lower() == 'nan' and str(df3['Forecast']).lower() != 'nan'): return 'Subir' elif df3['Forecast'] > df3['Forecast RELEX']: return 'Subir'…
-
0
votes1
answer77
viewsRemove row and column numbering from the Dataframe of an Array
I am making a program that reads a table in CSV and transforms it into an array in python using pandas, I was able to transform it but Dataframe numbered the rows and columns and I wish to delete…
-
0
votes1
answer321
viewsI need to add some specific lines in a data frame
I need to add the value of the lines in which appears "Resposnsável C', in a practical way I need to add lines 3, 4 and 9 from column 2, the result should be 112. So far I’ve been able to print the…