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
answer18
viewsInline formsets Django
Hello, I am until that experienced in Django but I am having an error that I am not able to solve, well the error is this, I have an inlineformset_factory and when I go to save it not saved and says…
-
0
votes2
answers59
viewsCreate Dataframe from lists with different sizes, keeping the data matching
I have lists of different lengths with data extracted from a PDF. Each value and code is part (is inside) of a respective note: cliente = ['12345','15432'] nota = ['21/0576750-3', '20/063859-1']…
-
0
votes1
answer61
viewsAdd values from a column that are duplicated using groupby as python criteria
I have a data frame that needs to be removed duplicates and later from the previous dataframe I need to add a specific column. Actually I have 5 DF, 4 have already worked, but one because it…
-
0
votes2
answers60
viewsDoubt in python with Opencv
Hello, I need to display a certain area of the image with the borders, using the Canny, and display it on top of the image itself, as in the example below. My code displays the selected area and…
-
0
votes0
answers40
viewsComparing names from two different lists - ideas on ways to compare
I’m trying to compare company names between two different lists. The case is as follows: both lists may contain different names for the same company, for example: Nome1: Escalar Nome2: Escalar Group…
-
0
votes0
answers30
viewsI want to remove all text that has % of a PDF. but it does not return me the result
I am trying to get back an administration rate of several PDF’s, however these PDF’s do not follow a standard, so I want to bring all the percentages that contain in this PDF, so the final file…
-
0
votes1
answer30
views(Python + Mysql) Enter the database password automatically in a dump
I am creating a Python script that backs up the company database I work on and it will run on crontab weekly. My doubt: How to enter the password automatically, since it is requested after the…
-
0
votes2
answers29
viewsRecent version of Django with SQL Server
Hello, I’m starting with a project where I will use the Django framework, and due to the nature of the project, I would like to use SQL Server (because I am more familiar), however, everything I…
-
0
votes1
answer57
viewsHow to use a python command in Windows?
I made a Python code that takes an excel spreadsheet with data from all over Brazil and creates several files separated by states. Ex: spreadsheet contains data from SP, RJ, BH, RS and etc... Python…
-
0
votes0
answers19
viewsKeyerror: None Flask
Hello, I’d like your help, because I’m trying to understand why you don’t perform!? config.py import os import random, string class Config(object): CSRF_ENABLED = True SECRET =…
-
0
votes1
answer33
viewsHow to create bar graph with 2 different y axes and the same x axis?
I’m trying to plot a bar graph with 2 different y axes and the same x-axis. The closest I’ve come to success with the following code: fig = plt.figure() # Create matplotlib figure ax =…
-
0
votes1
answer49
viewsHow to check if you have a number in your Python password?
I need help on a question about Python strings. The statement says the following: Write a program to read a password and check if it contains the security requirements: At least one uppercase…
pythonasked 3 years, 4 months ago JonathanMenezes 1 -
0
votes1
answer65
viewsAttributeerror: 'Function' Object has no attribute 'values'
Hello I am creating a program to create projects only when starting the program to see if started the window, where asks the path and the name of the project I came across this error Traceback (Most…
-
0
votes1
answer44
viewsHow to make the program run from any point of programming
I have a program using pyautogui that fills 20 web formulas sequentially, changing page by page automatically and put a timer for each page of 5 seconds. Usually the pages carry in 2 seconds what…
-
0
votes1
answer22
viewsIF no pandas returning The Truth value of a Series is ambiguous. Use a.Empty, a.bool(), a.item(), a.any() or a.all()
I have a DS with two columns, one with a month from 1 to 12, and another with a year from 2015 to 2021, and I’m trying to create a column called Fiscal Year. I am creating a function so that when…
-
0
votes1
answer92
viewsDoubt in Python Exercise Logic (Beginner)
Hello, I recently started my study in Python Programming Logic. I have a small base in C. I came across an exercise on the Internet where it says the following: "Make a Program for a paint shop. The…
-
0
votes1
answer37
viewsI would like to know faster ways to execute the insertion of information in one column based on the value of another
I have a Dataframe with numerous columns, but for the following question the important columns are: ID (number) of the report Product Event Example: id_relato event product 456 edema medication1 456…
-
0
votes2
answers65
viewsHow to search a list item and return in a message?
I’m starting programming, and I’m doing a bot on Discord using python (Discord.py) I need to create a command for the bot to return the availability of fruit within the list. class…
-
0
votes2
answers46
viewsI have a date/time start and end frame, how do I separate for dates / start time / end time on pandas?
In the database I have a report containing: INICIO FINAL 20/07/2021 09:17 20/07/2021 09:25 20/07/2021 09:17 20/07/2021 09:25 20/07/2021 09:17 20/07/2021 09:25 20/07/2021 09:28 20/07/2021 09:33 I…
-
0
votes1
answer41
viewsHow do I send multiple requests to the same URL (same API) in Python?
I’m calling an API that creates table in Hive. I’m developing an automated test script to make 30 requests and be able to create 30 tables in Hive. For this, I put a logic in which the tablename for…
-
0
votes1
answer50
viewsProblems with choosing the 'role' option in a program that 'plays' jokenpo with me
I’m doing a program that "play" jokenpo with me. The 'stone' and 'scissors' options are working. However, when I enter the 'paper' option and the machine chooses the 'scissors' option, the program…
pythonasked 3 years, 4 months ago Igor Araújo 9 -
0
votes0
answers29
viewsHow to paste with correct indentation?
It’s always a lot of work to fix indentation after copy and paste, but is there a way to paste with correct indentation? For example: x = int(input("0 ou 1? ")) if x == 1: print("ON") if x == 0:…
python python-3.x visual-studio-code ipython-notebook indentationasked 3 years, 4 months ago CrashXY 109 -
0
votes1
answer23
viewsPandas - Problems with ". Loc[]" in multiple inputs
My project has 4 user-given inputs that are stored in variables a, b, c, d. I use these entries to filter information from a giant . csv by storing it in a dataframe. The filter is made using…
-
0
votes1
answer29
viewsPandas group into groups with a determining range
beauty? I’m trying to group values of a dataframe called df_agenda by age, wanted to group the values in this way in the age: of (0-20),(20-40), (40-60) and so up to the maximum value of the list of…
-
0
votes0
answers45
viewsExtract values from specific parts of a . txt PYTHON
I have a Test Base that I need to extract some values in a standard way, but several times I receive more than one value between the beginning and the last line that starts with 0089 (CONVENIO) in…
-
0
votes2
answers81
viewsCheck which numbers are primes within a vector
I’m having a hard time with this activity: b) Module that takes as parameter an array of integers and returns the number of primes in the vector. This module should call the function IsPrime of the…
-
0
votes2
answers45
viewsDjango - No module named 'polls'
Hello, I’m starting to study Django (current version: 3.2.5), and I followed this article in an attempt to configure it (version consulted on 07/29/2021):…
-
0
votes3
answers34
viewsError clicking the Tkinter Python button
Hello I am developing a python application using Tkinter but I don’t know why it is giving me error. I was inspired by an example. My code. from tkinter import * win = Tk() win.geometry("400x150")…
-
0
votes1
answer71
viewsHow to implement the sine function using Taylor series in Python?
I’m having a little trouble with my code. I need to create a code that calculates the sine of an angle using the Taylor series, in the range of [-pi, +pi]. Thus, the sine function repeats. That is,…
-
0
votes1
answer31
viewsBuild application made with Flask
While running flash run, I get the following error: Error: Detected Factory 'create_app' in module 'spcdados.app', but could not call it without Arguments. Use…
-
0
votes1
answer39
viewsList saving values from last loop using Random at all positions
Guys, I’m trying to create a list of random values inside other predefined lists. Then in the loop it returns me exactly 10 lines with 4 data with different values. But when it exits the loop and I…
pythonasked 3 years, 3 months ago Nícholas Eras 3 -
0
votes1
answer46
viewsWhile repeating structure does not repeat specific code snippet!
I’m making a simple pair or odd python game that doesn’t perform correctly! When the player wins, the game does not ask again if he that even or odd! How can I solve? from random import randint…
pythonasked 3 years, 3 months ago Roberto Dias 11 -
0
votes1
answer22
viewssmtplib.Smtpserverdisconnected: Connection unexpectedly closed
I was trying to send an email with python: import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText host = 'smtp.gmail.com' port = 587 user =…
-
0
votes1
answer32
views"subplot" is giving error in "title"
I’m trying to spin a subplot,only that the title(title): > TypeError Traceback (most recent call last) > ~\AppData\Local\Temp/ipykernel_17364/305905731.py in <module> 4 >…
-
0
votes0
answers22
viewsTkinter error on re-entry
Was using tkinter, I made the code normally, and when I ran the same, everything was working normally, but when I left the program and entered again it gave error: my code: from tkinter import *…
-
0
votes0
answers10
viewsPython + Selenium + find_element
Good afternoon, I’m starting in Python and I’m making a web scraping robot for a site where I am obliged to inform user and password. I am using the Selenium and the part to inform user and password…
-
0
votes0
answers15
viewsI can’t access bet365 using the webdriver in python, what can I do?
from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from selenium import webdriver…
-
0
votes1
answer23
viewsHow to create a python executable program and publish to Pypi
I want to create a command on the linux terminal I created a simple program ( update the linux distro ) with Python and published in Pypi but how much and downloaded and typed his name was not…
-
0
votes0
answers29
viewsPython returns None when using "Sort" list method
I need to create a list that will be created by numbers entered by the user and, when inserting repeated numbers, this number should not be added. Finally, the program must present the list with the…
pythonasked 3 years, 3 months ago Fernanda Cunha Ferreira 1 -
0
votes1
answer60
viewsError: string indices must be integers in loop
good evening, I’m needing to do a for a request based on an excel, with that I’m doing so: df1 = pd.read_excel('D:/repositorio/python/leitura.xls') count = 0 for y in df1['EAN']: data…
-
0
votes0
answers30
viewsI cannot install Packages because my Pip is outdated and my Pycharm does not have enough permissions to perform the upgrade
I was trying to install the core but when I typed the following command pip install core I came across the following mistake ERROR: Could not find a version that satisfies the requirement core (from…
-
0
votes0
answers31
viewsAnimation for Andom Walkers
Hello, I am working with the following code, in which I simulate a walk Random and compare with a diffusion equation: In short: I am simulating M Random Walkers that move in a single dimension,…
pythonasked 3 years, 3 months ago Patricky Albani de Souza 1 -
0
votes0
answers38
viewsReply to tweets from a specific user with Tweepy
Using the library Tweepy, I’m trying to make a bot that reply in all tweets of only one specific user, the problem is that the bot is giving reply not only in the tweet but in everyone that retweet…
-
0
votes0
answers13
viewsView images in "Gallery" with Python (Tkinter)
Hello, the idea is to select all images from a directory (folder), it would display all these thumbnail images in a WINDOW via TKINTER (Python). I was able to locate all the directories of the…
-
0
votes0
answers28
viewsHow to click the Instagram FOLLOW button with Selenium using python
Instagram is increasingly hindering the use of automation on your site. This code click on the first button with the text 'Follow' You can use this to find and click: from selenium import webdriver…
-
0
votes1
answer35
viewsProblem with python modules
I’m trying to run a simple condition that consists of a requisition. Only every time I try to run it on my Ubuntu 20 it returns the following error File "autobump.py", line 1, in <module>…
-
0
votes0
answers44
viewsremove numbers from a list
I’m solving a question where I need to insert 5 values in a list, add all the numbers in that list and take out their arithmetic media, then I need to remove from the list all the numbers that are…
-
0
votes0
answers23
viewspygame error using key.get_pressed()
I was testing the pygame, and I came across a mistake. I made a red square appear on the screen, and I made the code for it to move too, set the WASD for locomotion, but when I ran the code, and…
-
0
votes0
answers17
viewsDjango does not display database images after filtering posts
I have a blog in Jango that separates your posts by category and each post has a thumbnail referring to it. On the blog homepage each image is displayed normally, but when changing the page to the…
-
0
votes1
answer30
viewsHow to unify dates with Python dataframe
Good afternoon guys, I have the following situation. I have a spreadsheet with the following columns: name, surname, dates(from 2011 until 2021) Follow the table to view: As you can see, these dates…