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
-
1
votes1
answer208
viewsHow to place arrows on the graph of a parametric curve - Python - Plotly
I posted that same question earlier on stack overflow (in English). I’m new in python and I’m learning to plot parametric functions using plotpy. Therefore, I "challenged" myself to write a code…
-
1
votes2
answers60
viewsola I am having difficulty in knowing how to link a question with a response of 2 separate lists (a list of questions and one of answers):
I need to make a program similar to the application "Anki", where the person will put a word in English and soon after its translation. The program must read all questions and choose one randomly to…
pythonasked 4 years, 3 months ago Luiz Henrique Schuster 13 -
1
votes2
answers297
viewsPython calculator does not return function
I started using Python recently and am creating a calculator to train factors like function, input and function return within another function. However, my calculator is not working, it simply does…
-
1
votes2
answers80
viewsHow to clear lines on pandas using a list as a filter?
Given the df as indicated below (could be a greater good), I would like to delete in df the data of the lines according to the list 'listFilter'. nome =…
-
1
votes1
answer149
viewsSelect data according to a specific time
I am doing a program in which, given the day of the week, the hours and the current minutes, he responds with all the "Doctors" available at that time. Each doctor has a period of care. For example:…
-
1
votes2
answers136
viewsHow to improve runtime
I have a csv with data from some matriculations I’m doing a study, I generated an id for each matriculation, and wanted to check if it repeats in the same year. I have the following code: # retorna…
-
1
votes1
answer76
viewsHow to generate an ID to identify a student in a database with enrollments of several years?
I have the following basis of dice that contains enrollments of an institution that is developing a research, in the future to make a mapping of students I need an id that identifies each student,…
-
1
votes1
answer72
viewsHow can I write a loop to calculate each value of a list that is not predefined
Hello, I’m beginner in programming and in this forum tb " I am having difficulty calculating the standard deviation of a list of values ( not a predefined list, it is done through an input) How can…
-
1
votes0
answers77
viewsPython Pulp package: how to create constraints using the max function
I’m writing linear programming using the python Pulp package. I’m having doubts about building a constraint. To illustrate the problem, imagine a square measuring 100 x 100 cm. I have several…
-
1
votes1
answer123
viewsRecursive Hanoi Tower with Play Counter
I wrote this recursive code from Anoi’s tower and was trying to implement a section that told me the minimum number of moves needed and what move we were playing ( add a move whenever it changed).…
-
1
votes1
answer1220
viewsI need to select the last Dataframe value to calculate the value of the next row in the same column
I need to select the last value of the column "Season Minimum" to calculate the value of "Mint", name I gave the variable of the same column, currently my line of codes is like this: import numpy as…
-
1
votes0
answers30
viewsProblems with Count method in a Django queryset
I’m in a strange situation with Django and Count method, I have a queryset that I called ranges and then I have a variable qtd_intervalo where I store the intervalos.count() then I do the tests: if…
python django web-application method viewmodelasked 4 years, 2 months ago Artur Fernandes de Souza Filho 21 -
1
votes0
answers192
viewshow to click a chor in Selenium Webdriver (python)
I tried to click an chor to return a value inside my input; I tried using the Xpath and the link_text to click on it. How could I do that ? Python code: window_segundo = driver.window_handles[1]…
-
1
votes1
answer24
viewsHow can I save these two python functions in separate files?
I created two functions, one to analyze the primes and the other to analyze the perfect numbers and I would like to know how to save the results obtained for the primes in a file and the other…
-
1
votes1
answer104
views<mariadb has no attribute Error> no python/windows
Hello, I’m trying to use mariadb with python in windows. My system is: Windows 10 Python 3.8.6rc1 Pip 20.2.3 I installed the connector: download mariadb-Connector-odbc-3.1.0-Win64. msi And installed…
-
1
votes1
answer52
viewsHow to merge these 2 dataframes and filter the latest timestamp to repeated values?
I have 2 dataframes that I would like to merge DF1: MRN Encounter ID First Name Last Name Birth Date Admission D/T \ 0 1 1234 John Doe 01/02/1999 04/12/2002 5:00 PM 1 2 2345 Joanne Lee 04/19/2002…
-
1
votes1
answer46
viewsProblem with Extractall not extracting exact occurrence
I have the following Dataframe: df = pd.DataFrame({'Texto' : ['é importante o sucesso', 'o dia está lindo']}) I have two names . txt palavras_positives.txt and palavras_neagtivas.txt. These two…
-
1
votes0
answers48
viewsLocal variable referencing to the same object of a global variable is changed, but the global is not
I have the following problem: I’m making a Red-Black Tree in Python, and when I delete a root that has only one child, the problem happens, below follows my code BLACK = 0 RED = 1 class No(): def…
pythonasked 4 years, 1 month ago Gabriel Henrique 101 -
1
votes2
answers66
viewsWhat is the basic format of a convolutional network in Keras?
Currently I study about neural networks in Keras and I can not understand how it mounts the basic structure of the network, how I am in high school gets very difficult I learn advanced without any…
-
1
votes1
answer244
viewsError involving Nonetype
I made a very simple code to simulate lines in python: lista = [] def a(lista): return lista.append(str(input('Nome: ')).lower().strip()) def b(lista: list): if len(lista) == 0: print('A lista está…
-
1
votes1
answer242
viewsHow to collect Tweets in real time with tweepy in Python
I am working on a project that consists of collecting the tweets posted here in Brazil, I am using the Twitter API and the tweepy library of Python, I can take the terms that are in trending Topics…
-
1
votes0
answers38
viewsParticles.js as background using Dash Plotly
I’m using the library Dash plotly from Python to create a view of macroeconomic indicators, I would like to use as background the Particles.js because it creates an incredible effect, here is the…
-
1
votes0
answers45
viewsListening to stdout from the Linux console with python3
I’m trying to make a script in python that I need to hear the stdout linux console. The script is to test serial transmission error rate for image recording of an OS on an iMX collibri card, as…
-
1
votes2
answers83
viewsHow to consult with Elasticsearch-dsl?
I’m starting to make queries with elasticsearch_dsl and I’m getting lost to returns my object by product name. from elasticsearch import Elasticsearch from elasticsearch_dsl import Search,…
-
1
votes1
answer63
viewsHow to sort with Elasticsearch while maintaining search relevance?
I’m trying to search for a word in Lasticsearch with python and sort by one of the columns, but this is changing the result the way I really wanted it. For Ex: When I search without order it returns…
-
1
votes1
answer650
viewsRun python script by clicking html button
I need to feed a page html that will load and display the content dynamically with ajax/fetch. The problem is that I need to take this data from other websites that also upload this content through…
-
1
votes0
answers37
viewsHow do I center a text with the python PIL library?
so guys, I did an event on_member_join with an image using the Pillow library, and I’m looking for help to make the PIL calculate the text size and center it according to the user’s name, can help…
-
1
votes1
answer120
viewsHow to verify null value in rows in a dataframe column?
I’m looking to replace the null values with the value of the year. Given the following dataframe : year value 2000 1 NaN 2 NaN 3 NaN 4 NaN 5 NaN 6 2001 1 NaN 2 NaN 3 NaN 4 NaN 5 NaN 6 ... 2020 1 NaN…
-
1
votes1
answer337
viewspython and excel(doing automation)
this code below it takes dice from a spreadsheet and plays on a list then want the dice from this list plays on another spreadsheet. Until the list get but when it comes to moving to another…
-
1
votes2
answers189
viewsfilter dataframe by python line
Hello, I own this Dataframe with hundreds of thousands of lines, I want to filter so that selection is only the desired lines, in case more current lines, follow an example of what I want: the…
-
1
votes1
answer33
viewsHow do I make the code find the positions that x repeats and put them in output one per line? Python
How do I make sure that, in the following code, the values that show the position where x is repeated are each one per line? Except for the clasp and comma. from collections import defaultdict n =…
pythonasked 4 years, 1 month ago Gabriel Schrader 45 -
1
votes0
answers1019
viewsAttributeerror: 'Nonetype' Object has no attribute 'saldoConta'
I’m starting my POO studies with python and I took a class test ContaBancaria very simple, whose methods would only be withdrawal and deposit. But when I interact with the user, I can’t assign the…
-
1
votes1
answer71
viewsHow to add a value key to a dictionary?
I want to add terms to an organized dictionary-like glossary, requested by an activity, but I’m getting an error message that I can’t identify why. glossario = { 'concatenar': 'Concatenar é a junção…
-
1
votes1
answer63
viewsHow to include minimum_should_match in the query of Elasticsearch dsl?
I’m trying to use the minimum_should_match how are you in documentation q = Q('bool', must=[Q('match', title='python')], should=[Q(...), Q(...)], minimum_should_match=1 ) s = Search().query(q) But…
-
1
votes1
answer54
viewsI have Jango in python Anyhere my view that generates pdf works locally but on the error server!
Hello, I have a system in Django/python very simple to manage sweepstakes, and last xhtml2pdf to generate reports in pdf, when ultilizo it locally it works perfectly did the deploy in python…
-
1
votes1
answer346
viewsHow to transfer file using python socket?
I’m making a program that consists of passing a file using UDP protocol. The user who runs the file client.py should have files in the root folder of the program in order to transfer to the folder…
-
1
votes1
answer418
viewsHow do I make Python click a button in google?
I’m making a bot that enters google Meet at scheduled times, got the part of opening the meetings at the desired times, but I bumped into the problem that the program needs to click the "enter"…
python web-application google selenium-webdriver schedulingasked 4 years, 1 month ago Adelson Thalys 25 -
1
votes1
answer545
viewsI cannot install matplotlib, Python 3.9
It starts occurring normally and out of nowhere, after a few lines, it starts a series of errors. I’ve even updated Visual Studio in every possible way. Follow the error: C:\Users\dborg>pip…
-
1
votes1
answer73
viewsJsondecodeerror Expecting value: line 1 column 1 (char 0) - content-type: text/xml
I have a project to capture Atms next to a coordinate on the Mastercard website form. I can bring the result but not in json. By Content-Type be text.XML, should not allow to bring result in json?…
-
1
votes1
answer1640
viewsHow can I make two graphs in the same Python Plot in Jupyter Notebook?
I’m trying to create charts in Jupyter Notebook in Python for the first time using data from an excel file for my Master’s Thesis, because I don’t want to present the charts in Excel and want to do…
-
1
votes3
answers464
viewsIdentify amount of upper and lower case letters in a string
I need to check if a word has more upper case letters and replace the whole word for lower case only, also check if it has more lower case letters and replace the whole word for upper case. For…
-
1
votes1
answer75
viewsReturn name instead of foreign key ID
I’m developing a Python system and wanted to return data from the specific database, only instead of the foreign key id I wanted to return the name of that person. The creation of tables:…
-
1
votes0
answers127
viewsPython - How to remove line in the middle of markers and additionally place trend line equation in Python
Good afternoon. I’m trying to create a graph in Python, in a Jupyter Notebook in Anaconda where I’d like to put the trend lines for each of the lines and the linear regression equation. I was able…
-
1
votes1
answer56
viewsCollect fraction of a text in a Pandas column [Python]
Good afternoon! I’m having a hard time separating the name of the countries into a string column (text), where I don’t have a common separator, I’m not even sure where to start. Basically, my idea…
-
1
votes0
answers79
viewsHow can I use an xpath path already mapped and saved in csv to confirm access on site?
good afternoon! I am somewhat new in the area of programming and I am trying to develop a script, so that it enters a certain site, within a file . csv, choose an educational institution, confirm…
-
1
votes0
answers70
viewsProgram not responding PYQT5, when I need it to stand still for a few seconds (WIFI,UART,ESP32)
I am facing the following problem, my program sends when the object, modemlist which is a Qcombobox is in the WIFI option I send a request to the esp show me the available networks and it takes a…
-
1
votes0
answers73
viewskivy : The term 'kivy' is not recognized as cmdlet name, function, script file or operable program
When trying to run script from kivy.app import App from kivy.uix.gridlayout import GridLayout from kivy.uix.label import Label from kivy.uix.textinput import TextInput class TelaLogin(GridLayout):…
-
1
votes1
answer202
viewsHow to use the negation operator in regular expressions for a specific string?
Studying the negation operator in regular expression ([^]) regular, I understood that it is possible to deny an isolated character (e. g., [^x]: anything other than "x") or a range of characters…
-
1
votes1
answer146
viewsTypeerror: 'Function' Object is not subscriptable, how to resolve? Pyside2 Qtableview
I’m making the code to view my sqlite3 table in Qtableview, but when I put to view the table, at the time of running the code, this cited error arose, but I could not find how to solve it... Follow…
-
1
votes0
answers18
viewsReadjustment of an LPU using Python
Hello, I am writing a code in python, using the citizen calculator library, to readjust the items of an LPU to register 12 months, the LPU will be inserted by an excel, the base date of the reajsute…