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
answers12
viewsHelp with Indexerror error: list index out of range
class Scraping: def pesquisar_nome(self): while True: try: self.browser.find_element_by_id('search-key').send_keys(self.Keys.CONTROL, 'a')…
-
0
votes2
answers68
viewsJoin cells with python
I am making a web scraping to take data from the best actions of the day and join in a table in an excel file. I am trying by code: from selenium import webdriver from webdriver_manager.microsoft…
-
0
votes1
answer30
viewsDjango Oauth2 Facebook autentication
When trying to include facebook login authorization on my site, I followed the steps taken in Django and similar documentations. And doing step by step, including the app in Settings…
-
0
votes1
answer57
viewsDoubt For i Range Python
First, I have 2 dataframe with several latitude and longitude points: db_gas2['lat-long'] = db_gas2['latitude'].astype(str)+', '+db_gas2['longitude'] db_gas2 db_cidades3['lat-long'] =…
-
0
votes0
answers49
viewsDelete lines from a Dataframe from a list of python strings
I am with A Dataframe for analysis of Covid-19 and When I pull the largest amount of cases or deaths, return me to the continents and I would like to delete only the entries where the continents…
-
0
votes0
answers26
viewsWhy is returning Indexerror: list index out of range
Does anyone know why you’re making this mistake Traceback (Most recent call last): File "c: Users David Pythons Files that speaks main.py", line 194, in Take_query() File "c: Users David Pythons…
pythonasked 3 years, 6 months ago Davi Sales - Games 1 -
0
votes0
answers17
viewsConditional - If, Elif, Else
I am a beginner in Python and I have the following script running by Vscode and Pycharm terminal. from math import pi import sys def help(): print("É necessário informar o valor do Raio.")…
-
0
votes1
answer62
viewsAccessing a Pyqt5 Widget and modules within a package
I am making a program using as GUI the framework PyQt5, using UI files. I’m having trouble accessing the module inside the file .py that I create so that I put the functions inside them and thus…
-
0
votes4
answers143
viewsShow days of the week
I built this code to show the day of the week. It works, but I wonder if there is another way with fewer lines/commands I could use. Or a more 'clean' way so to speak. import datetime # Pega a data…
-
0
votes2
answers22
viewsDjango queries Related Objects
So with two models created : class Questao(models.Model): texto = models.CharField(max_length=220) quiz = models.ForeignKey(Quiz, on_delete=models.CASCADE) created =…
-
0
votes2
answers75
viewsLoop two functions at the same time
I would like to run two functions at the same time in Python, follow my code: import socket from pyftpdlib.handlers import FTPHandler from pyftpdlib.servers import ThreadedFTPServer from…
-
0
votes1
answer50
viewsHow to resolve Qobject::connect: Cannot Queue Arguments of type 'Qvector<int>' error in Pyqt5 using threading to update Gui interface
Good night, I’m a beginner in the python area, and I’m having a hard time threading along with a Gui interface, created in QT Desegner. Talking to some friends showed me this forum, because maybe…
-
0
votes0
answers33
viewsHow to create a simple HTML page with Python
Good night. I’m solving all the Pythonbrasil lists, I’m on Listadeexerciciosprojetos 1. I managed to solve the problems but I’m not able to assemble the HTML page, I haven’t programmed for a long…
-
0
votes1
answer30
viewsHow to add more values in a numpy matrix?
I am doing a program in python that uses matrices, I am using numpy to do them, but it is giving the following problem: I do the matrix in order to save several values, but it keeps only one. I was…
-
0
votes1
answer47
viewsHow to limit the number of lines writing CSV Python?
I am new here, I am very beginner in programming and I am starting with Python. I am in a personal project that is well advanced but I am with a very specific difficulty, I want to write in a CSV…
pythonasked 3 years, 6 months ago Thiago Aragão 11 -
0
votes0
answers29
viewsHow to add user types in groups in Django?
I rewrote the User Django model for CustomUser using AbstractUSer adding two booleans, such as is_admin and is_insurer. Moreover, two groups were created programmatically: admin_group and…
-
0
votes1
answer62
viewsHow to receive and send data from an React application to a Flask API?
I am making an app in React and would like to use Flask to save user data in a local database. I was able to make React and flask "run on the same door" and thus enable a connection between them.…
-
0
votes0
answers47
viewspython probability density function
I can’t create a continuous probability density function for a random variable to plot it over the histogram. val = df[['posição', 'num']].groupby('num').agg(lambda x: list(set(x))).reset_index()…
-
0
votes1
answer49
viewsHow to send a Javascript parameter to Python?
How I send a parameter to be read by a function in Python? I have the following function in Python: @app.route("/add") def add(book_id): """Atribui o ID de um livro ao ID do usuário"""…
-
0
votes1
answer25
viewsdisplay a single Django class value
I would like to know how to show in my html template, a single character of my model "Character". this is my models.py, I inserted 10 characters in this class via Django admin: py models file. from…
-
0
votes1
answer40
viewsHow to turn every two records of a Datframe into a single in Python based on two columns
Expensive, I have a Dataframe in which every two lines refer to a single record. I need to make a union of these lines based on the "id" and the "boss" to turn into one. The "principal" column has…
-
0
votes0
answers14
viewsHow to make an Sprite turn red and return to the original color?
I am recreating a game in pygame as a hobby, in this game I have a ship that can take a single shot or keep shooting if you hold the button, but the ship will heat up and gain a red coloring. But…
-
0
votes0
answers62
viewsAutomate excel in python sequence
In a google form that transforms all filled data in excel spreadsheet, I did in python a programming that copies the data of the first line and fills a form I need. There is the possibility of this…
-
0
votes0
answers16
viewsMultiple rows of dates to turn into 2 columns in a df with a start date range and end date
I have the following df: time_series date sales q1 q2 q3 store_0025_item_85011885 2020-07-19 4.0 0.0 2.0 1.0 store_0025_item_85011885 2020-07-26 4.0 0.0 2.0 1.0 store_0025_item_85011885 2020-08-09…
-
0
votes0
answers14
viewsHow to show multiple lines on an output line (output)?
I study in the course of Computer Science. I made a simple encryption using Caesar’s Cipher. I managed to encode, but I have a problem that is that my program shows several lines in output, which I…
-
0
votes0
answers23
viewsDjango Session permitted for user
I have a Django application that registers a user, using the Django User table. Everything of that scope is working but there have to be restrictions. When accessing username1 account and username2…
-
0
votes0
answers27
viewsError: Mysql backend does not support Timezone-Aware datetimes when USE_TZ is False
I’m having a problem in the pagseguro api, I’m using Django 1.8 when I try to send a payment it presents the error "Mysql backend does not support Timezone-Aware datetimes when USE_TZ is False." I…
-
0
votes1
answer68
viewsCan I do better code than this in Python? I’m a beginner in the language and would like to know if I’m on the right track
Objective of this program is to receive the radius of the user and calculate the area of the circle. I’m a beginner in Pyhton, so I’d like to know if this is the most efficient code I could do to…
-
0
votes1
answer52
viewsPYTHON - RPA - Wait PROCESSING window to continue automation process
I am automating the generation of reports in a web system, SAP. In this process I use python, with the libraries: Selenium and rpa. I was able to find the fields to enter the information, however,…
pythonasked 3 years, 5 months ago PauloGalego 105 -
0
votes0
answers22
viewshello, I would like to understand these two code in Python and what is the function of (self) in the set_name function
hello, I’m new to Python and programming in general, I just got into object orientation and I can’t understand why 'self' in the following code functions; I think because I studied an introduction…
-
0
votes1
answer21
viewsDjango - How to interact 2
In Form1 I have this entry "name_car". This form saves normally in the database. In form2 I have the same field "name_car" to put the "pieces". Question: How to bring the Form1 car name to the form2…
-
0
votes1
answer31
viewsDifficulty Merging Sequential Columns in a Dataframe with Pandas
I have two dates frames, the two have exactly the same index, the difference is that one has the columns 'week 9' until 'week 30', and the other has the columns 'week 31' until 'week 53'. Until now…
-
0
votes0
answers24
viewsValidation Flask Wtforms
I am developing a web project and am having problems in the form validation part. Just follow my validations: # REGRAS DE VALIDAÇÃO # def validate_username(form, username): if…
-
0
votes1
answer44
viewsAllow maximize and minimize windows in Pysimplegui
I’m trying to make a text/note program, like Word or notepad in Pysimplegui. Before I started doing it, I needed test programs, and in one of them I have a problem: allow to maximize and return to…
-
0
votes1
answer33
viewsGroup By without merging python data labels
Hello, people, I have the dataframe below and I need to group and add the columns. For this I am using groupby, but in the result the labels are cancatenated, there is a way that this does not…
-
0
votes1
answer78
viewsFunction extract Python csv column
I did this function to extract the desired column from csv. Then, make an append in column[] passing a while to only take the Dice from the corresponding column. And finally a condition to separate…
-
0
votes0
answers57
viewsHow to separate numbers in python?
Write an algorithm that takes an integer value m. Soon after, your program will receive a sequence of integer values greater than or equal to 0 and smaller than m, separated by a comma. Your program…
-
0
votes1
answer27
viewsProblem running a Python script with classes
Create an employee class with the following attributes: number name salBruto salLiquido taxaIRS fees And the following methods: calcIRS() calcSS() calcSalLiquido() Taking into account the following…
-
0
votes1
answer22
viewsPick up api information with local socket
Good afternoon, I am developing a program to process Whatsapp messages and answer them (chatbot) and for that I bought a program called zapmax, in it is detected the message and is sent to the…
-
0
votes1
answer70
viewsHow to run a python script using VBA
I created a project that consists of sending automatic messages through the Telegram API, I did all this part in Python and works perfectly, as shown below. import requests from datetime import date…
-
0
votes3
answers84
viewsCopy between strings inside Python lists
The operation consists of comparing two lists of strings, detecting which items are common and placing them in a certain order in a new list. The closest I got was: nova = [] lista = ['a', 'b', 'c',…
-
0
votes1
answer36
viewsAttributeerror: type Object 'User' has no attribute 'order_by' - Sqlalchemy
I am trying to sort the Transaction table id accordingly: from sqlalchemy import desc from sqlalchemy.orm import query from website.models import Transaction def home(): transactions =…
-
0
votes0
answers18
viewsRegex for AFD files
Good morning I have a Txt file with a series of lines that divide the point beats that we have here in the company. Each line of this can contain the hit information, such as the time and…
-
0
votes1
answer88
viewsCount dataframe lines with string according to position in Python text
I have a dataframe with a text column, as follows: import pandas as pd df = pd.DataFrame([["1", "texto com PALAVRA frAse PARAGRAFO", True, "foo"], ["2", "texto com palavra Paragrafo", False, "foo"],…
-
0
votes0
answers16
viewsDoubt about if, Elif and Else
Good morning/late/evening I started to venture into the recent python and was making a code for a simple calculator exercise. print('Calculadora simples') def calculadora(): x1 = int(input('Digite o…
-
0
votes0
answers19
viewsHow to remove text from a site and put in a variable, when it does not find with xpath the path
Good morning! I am trying to extract from a site a text that is variable, but it does not find the element with the find_element_by_xpath or with the…
pythonasked 3 years, 4 months ago Douglas Casavechia 1 -
0
votes1
answer18
viewsHow to use "Objects.filter" by selecting only the logged in user in the application?
I am using Django authentication and in HTML templates works very well when I use for example: {% if user.is_anonymous %} ... {% else %} ... {% endif %} I would like to use this same "user", which…
-
0
votes1
answer50
viewsLoad multiple functions on main page using Django
I’m having a problem trying to load some data from mysql database using Django, type functions only work if I assign in the file: py. the following attribute: path('', views.countregistered) But…
-
0
votes0
answers27
viewsDjango.urls.resolvers.URLResolver. _reverse_with_prefix() argument after ** must be a Mapping, not set
Hello I’m trying to do an e-commerce with Django, I was following a tutorial until the creation of the products, the page worked ok (no products and categories), when I added a category and a…
-
0
votes0
answers5
viewsAccess Picker dialog seleniun sugem in Google (Python)
Hello I’m a beginner in programming, and I couldn’t find an explanation of how to solve my problem by searching the net. I am trying to access a spreadsheet file that is in my GDRIVE, through MY…
python google-chrome selenium-webdriverasked 3 years, 4 months ago Francisco Carlos Moreira Gomes 1