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
votes1
answer287
viewsSelenium Webdriver python headless does not identify elements
Good afternoon, I am programming a python file using Lenium. I reached my goal and the file ran smoothly. I went further and decided to use the headless, already at the beginning of the file…
-
0
votes0
answers61
viewsHow to detect and calculate the angle of an object inside a python image?
I’m trying to write a code that detects lines and calculates an angle within a binary image (not necessarily this one, but always a similar spray). I read a few things about Hough Transform and even…
-
0
votes0
answers33
viewsHow to find subsequences of a given vector, excluding given positions?
Given the vector v: [7 , 8 , 30 , -2 , 9] And the vector rem, which contains, in ascending order, the positions removed: [1 , 4] It is necessary to do a function seq(rem,n) (where n is the number of…
-
0
votes1
answer632
viewsChanging data from an entire table column - Python
battle in the "FOR" loop continues. Well, I’ve come across a problem I can’t solve. I have a table and all your data is of type string, in a certain column the data of each row are letters and…
pythonasked 4 years ago Edu Barros 59 -
0
votes1
answer58
viewsPython - Plotly filling white image
The goal is to plot a Dashboard, for this I imported the following libraries # Importando bibliotecas import ipywidgets as wd import cufflinks as cf import pandas as pd import yfinance as yf import…
-
0
votes0
answers49
viewsCreating new dataframes and using merge
I used yahooquery to import a historical data series of 100 exchange-traded assets. I created a dataframe with this data for a period of 6 months: df = tickers.history(period='6mo', interval="1d") I…
-
0
votes1
answer179
viewsCreate spreadsheets with Django
Hello, I am implementing a button to turn a Query into a spreadsheet and make this download available. For this I created a View to generate Excel, follows: def export_view_csv(request): if request…
-
0
votes2
answers63
viewsHow do you compare an item with all other items in the same list (with dictionaries inside) in a pythonic way?
I’m a beginner, guys. Just for the record! I am trying to compare the items on a list with dictionaries and if they are equal, add these items. I think with one example, the idea becomes clearer:…
-
0
votes1
answer51
viewsDjango. I can’t pass the model I’d like through classes
I’m having a problem creating a page to create new products and know I’m having some problem with Oop for lack of experience. I would like to pass the value of self in this case being self==Product,…
-
0
votes1
answer35
viewsThere is no error in the execution of the code, however the return I am having in the excel table is that is the problem
I have a problem returning my code. I do not get any error in the execution, but the problem is the return in the Excel table. I’m doing a case study of my college and the system is about customer…
-
0
votes0
answers59
viewspython requests post application
I am sending data via post to a web application made in Aravel with the CSRF active. This is the form: Note: I edited the _token. !DOCTYPE html> <html lang="en"> <head> <meta…
-
0
votes1
answer1304
viewspyodbc.Interfaceerror: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Name of data source not found
I am creating a code to perform an adjustment in a sql server database, but when trying to run it is returning error: pyodbc.Interfaceerror: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Name…
-
0
votes1
answer124
viewsHow do I call an asynchronous corotine within a function that is initialized into a thread?
import telepot, time, threading, asyncio from telepot.loop import MessageLoop from datetime import datetime from telepot.namedtuple import ReplyKeyboardMarkup, KeyboardButton, InlineKeyboardMarkup,…
-
0
votes0
answers39
viewsI would like to iterate on a Beautiful Soup object, but at the end it gives an error in find() because it is a list. How could I solve this error?
import requests from bs4 import BeautifulSoup import pandas as pd def get_object(url): soup = BeautifulSoup(requests.get(url).content,'html.parser') return…
-
0
votes2
answers93
viewsDate change of a monthly average of Pandas
Hello. Using the code below I perform a monthly average, but it is fixed on the last day of the current month and I would like to know if it is possible to configure it for a fixed day of the month…
-
0
votes0
answers83
viewsWarning Elasticsearchdeprecationwarning: this request Accesses system indices
I’m getting a Warning when trying to get all indexes in Elastic after the latest version update. Warning. C: Users... Appdata Local Programs Python Python38-32 lib site-Packages Elasticsearch…
-
0
votes1
answer35
viewsProblem checking between two python variables
This code is made to generate a password of X random numbers (1 in the case), and then loop random passwords until you get to the initial password, "bruteforce". Although it can generate the first…
-
0
votes0
answers36
viewsBug while running program in Pygame
I have a problem creating the game menu. What happens is that when I create the function draw_text, the program is on black screen and I notice that it shows nothing on the screen causing it not to…
-
0
votes1
answer67
viewsFunction "Procv" with pyspark
I am beginner and would like to know if there is any code to correlate two spreadsheets by means of index (CAUSE_CODE), like a PROCV in Excel, but in Pyspark. %pyspark machine_A_grouped =…
-
0
votes2
answers312
viewsHow to fill a column of a DF Pandas using, as a comparison, a specific column between this and another DF?
I have a Pandas dataframe, in which I need to add a new column called codprojeto. To do this, I created this new column and inserted zeros, so that it has the type int64, as follows:…
-
0
votes0
answers131
viewsChange page language with python and Selenium
I’m trying to make the web scraping on Amazon with python and Selenium, but I need to translate the page to English first. This is my code: from os import getcwd from selenium import webdriver from…
-
0
votes0
answers68
viewsDocker Compose - pymongo - server_type:Unknown
I want to place my application in TWO Docker containers. One with mongodb (official image) and one with the Ubuntu image, which runs a series of scripts to populate the database. I’m having trouble…
-
0
votes1
answer32
viewsHow to make the program recognize a name with spaces next to a float?
Code: compras = {} soma = 0 while True: dados = input().split() if dados[0] == '*': break else: compras[dados[0]] = float(dados[1]) while True: comandos = input().split() if comandos[0] == 'total':…
-
0
votes0
answers43
viewscreating a dataframe from pairs of columns in Python
Using the yfinance library I imported data from a list of 80 assets: tickers=['xxx','yyy'] data = yf.download(tickers, start="2020-01-01", end="2020-12-04") data = data['Close'] I used a function…
-
0
votes1
answer714
viewsWriting a csv file on Google Drive using Colab
I’m writing a code in Python to scrape information off Facebook. I would like to save this information in a file on Google Drive, since I am working with other people and we use Colaboratory.…
-
0
votes1
answer443
viewsDiscord.py error in on_message
I was programming and came across the following error, if I have only @client.command(), codes work, but if you already have a @client.event with on_message, it works only the event. I already tried…
-
0
votes0
answers18
viewsDjango page with Class Based Views
Hello, I have a problem with paging in Django, using Class Based View. Below are the code snippets: py views. class ExtratoListView(LoginRequiredMixin, SingleTableMixin, FilterView): model = Extrato…
-
0
votes1
answer76
viewsHow to print lines that have a certain word in python?
I’m taking a test and she has this question : "Make a program that receives sentences and insert them into a new file called string.txt. Next the program should read the file and print only the…
-
0
votes1
answer204
viewsError while trying to import pandas data into Jupyter Notebook
I am trying to import data using pandas, but I always get the following error: File "<ipython-input-15-fb05c39e0291>", line 1 temperaturasDasCidades =…
-
0
votes0
answers25
viewsFind the chosen option in HTML with Django form
Hello, I created a form with some options to be chosen, follows Forms.py file class BuscaForm(forms.Form): FIELDCHOICE = [ ('1', 'CNPJ'), ('2', 'Razão Social'), ('3', 'Nome Fantasia'), ('4',…
-
0
votes1
answer544
viewsTypeerror: 'int' Object is not iterable
def add_divisors(list_num): final_list = [] for number in list_num: final_list.append([number]) for sublist in final_list: for number in sublist: for x in range(1, number + 1): if number % x == 0:…
-
0
votes0
answers51
viewsError renaming columns in dataset using pandas
While trying to rename the dataset columns using pandas, SyntaxError: expression cannot contain assignment, perhaps you meant "=="? Below the error with the line of code I’m using: File…
-
0
votes0
answers10
viewsHow to repeat a code at the end?
Hello, I’d like to know how to make this code repeat at the end, I know it may seem simple but I haven’t found anywhere the answer var = int(input('Insert: 1 for +; 2 for -; 3 for X; 4 for /; 5 for…
-
0
votes0
answers58
viewsProblem with RSA, python
guys, I’m trying to make a project based on: https://github.com/GoogleCloudPlatform/iot-core-micropython The problem starts when I get to the decode_rsa.py, in my cmd, I have it:…
-
0
votes0
answers30
viewsDjango - Choice Field None:
I’m having trouble making one Choice Yeah, when he goes by form, the field returns only "" or None. Already if I put widget=RadioSelect, it returns the correct numbering. Model: ORDER_CHOICES = (…
-
0
votes1
answer28
viewsimports csv files automatically
I have a list of several csv files in a single directory it happens that every 5 min more file enters this directory file example:…
-
0
votes1
answer70
viewsPython: Problem with random numbers within while
I would like to know how to solve a small problem I am facing in this and other codes. When testing the example you will realize that it will use the same atk always, that is if he chooses the atk…
-
0
votes2
answers355
viewsFloat to str conversion without losing two decimal places and changing decimal separator
In Python, I need to convert a float to string and replace the point by comma, without losing the two decimal places. I have tried several ways, but could not. In doing: >>>…
-
0
votes1
answer243
viewsIntegration with Python and JS
At the moment I’m developing an application that uses a JS code to generate a photo of a div and a python script that sends an email with a photo attached, I wonder if there is a viable way to…
-
0
votes0
answers38
viewsWhat is the correct procedure for installing the PYGSLIB library?
Anaconda had been installed with version 3.8 of Python, but was unable to install the specific library, the following error occurred: UnsatisfiableError: The following specifications were found to…
-
0
votes0
answers35
viewsPython packages, how to send json files
Hello! The title seems a little contradictory, but the following is happening, I’m making a library in python 3.8 and using the following way to install it: pip install…
-
0
votes0
answers31
viewsIn Instabot, how can I make the program ask the user again if he misses the password or username?
from instabot import Bot bot: Bot = Bot() print('Bem vindo ao Fox_InstaBot!\nFaça seu Login.') ret = bot.login(username=str(input('User_Name:')), password=str(input('User_PassWord:'))) I’m using the…
-
0
votes2
answers63
viewsIs there any way pd. Grouper, how much used for time frequencies, adds lines even when there are no records in a time interval?
I need to merge between two tables where the base table is grouped at 5 minute intervals, however in an interval that has no record to be grouped the corresponding row is not created I am dealing…
-
0
votes2
answers56
viewsLooping and Finishing? In Python
Hi, guys. I have a problem with my program. I’m not getting it looped until I "shut it down" it. I’ll be leaving his code, making it easier for you to understand. Where the operator selected to play…
-
0
votes0
answers40
viewsHow to zip files on a Cloud Storage Bucket using Python?
Good morning guys! I need to zip the files present in a particular Cloud Storage Pack. I have tried several alternatives, but so far unsuccessful. Please, could you help me with this question? At…
-
0
votes1
answer54
viewsHow to handle errors if the user enters an invalid character?
I wanted to do in the notes entry part, and in the final part of showing each student’s grades individually, something similar to what I did in the 'Want to continue? [S/N]', that is, only step…
-
0
votes0
answers21
viewsNoreversematch at /blog/ | in a Django app
good afternoon. First of all, this is my first question on stack overflow. So I apologize if it’s too vague. I started to study djnago in the last days and I came across the following mistake:…
-
0
votes1
answer122
viewsAdd a new column in a Dataframe after comparing data with another Dataframe?
I have a dataframe df_currency and need to insert new column based on comparison with another dataframe df_quotation. Below I have dataframe only with the names of coins:…
-
0
votes0
answers32
viewsDimensions must be Equal, but are 3 and 5 for...with input shapes: [32,3], [32,5]
I’m building a neural network, and I find the following mistake: ValueError: Dimensions must be equal, but are 3 and 5 for '{{node mean_absolute_error/sub}} =…
-
0
votes1
answer136
viewsFlaskform validation with Flask - Form failure.validate_on_submit()
Good afternoon guys, all right? I created a form using the flaskform class, from flask_wtf. I can send it to the front of the application and apparently the behavior is correct. However, when I…