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
answer38
viewsI have a question about how I can add each item of 2 lists and play the results of the sum to a third in python
I have the following program #Faça um programa que percorra duas listas e gere uma terceira sem elementos repetidos. x = [] y = [] z = [] while True: n = int(input("digite um número(0 sai): ")) if n…
-
0
votes2
answers48
viewsHow do I delete a line that contains letters in a dataframe?
I want to exclude lines containing letters in that dataframe dic = {'Código':dataframe['Cod'], 'Dimensões': list_no_x} new_dataframe = pd.DataFrame(dic) print(new_dataframe) The way out is like…
-
0
votes0
answers20
viewsWhat happens if I modify a python script during its execution?
I am running a script Python which takes a few hours to complete. After running it, I fixed an error in the code. The fix I made is on a line of code that hasn’t been executed yet. So, this is where…
pythonasked 3 years, 4 months ago Adolfo Correa 258 -
0
votes0
answers28
viewspython3.9 + matplotlib Does not call import in . py
So ... python version 3.9.1 did a Pip install matplotlib and ran smoothly, despite questions with previous installation errors. It turns out that : import numpy as np import math import matplotlib…
-
0
votes0
answers16
viewsI can’t change the size of a picture - Matplotlib
I need to create a figure in bars, I’m trying to increase the size, as follows: plt.figure(figsize=(8,8)) plt.bar(df_nacoes_ano) plt.show() But I get the following message: TypeError: bar() missing…
-
0
votes1
answer32
viewsWhen creating a new pair in a dictionary lose the previous data?
I’m creating a Dict from scratch, but when I add some new pair, the old pair gets lost. If I try to print 'name' for example, it gives error. cidade = { 'nome': 'São Paulo', 'estado': 'São Paulo' }…
-
0
votes0
answers13
viewsHow do I interrupt a python function?
The problem is this: I want to make a function not make its execution complete if a certain condition is met. Example: a = 1 def function(): if a is 1: pass #aqui seria o local onde que a função…
-
0
votes0
answers33
viewsHow to search for array in postgres through sqlalchemy?
My database has a column like ARRAY(sa.BIGINT). My intention is to use the command filter_byof sqlalchemy to search for an element that has the list_secao_id field equal to [58,45,12], for example:…
-
0
votes0
answers16
viewsI would like to know the concept of Querystring , what is it ? , what is it for ?. I am in a class on flask and was introduced to me about Querystring
@app.route('/novo') #novo.html def novo(): if 'usuario_logado' not in session or session['usuario_logado'] == None: return redirect('/loguin?proxima=novo') return render_template('novo.html',…
-
0
votes1
answer627
viewsTypeerror: 'Autotrackable' Object is not callable
I am trying to use an imported tensorflow_hub model as shown below: #%% from sklearn.model_selection import train_test_split import tensorflow as tf import tensorflow_hub as hub from keras import…
-
0
votes1
answer155
viewsInteraction between Threads in Python, error message " Object is not callable"?
I am doing the interaction of 4 Threads, but when running them at the same time appears the following message: Object is not callable That is, the object cannot be called. How to fix it? Follow the…
-
0
votes2
answers48
viewsPython: upper and Lower function do not work
I’m conducting experiments on Python and this time my targets were the functions that handle Strings. In my tests, I’m trying to make a text converter, however, the functions are not performing…
-
0
votes1
answer28
viewsTypeerror: can only concatenate str (not "_io.Textiowrapper") to str
Hello, I’m trying to make a Virtual Assisstente, but it’s giving me an error that I don’t realize what’s going on name = open("user_data.txt") user = name.read() def main(): main_question = input("O…
-
0
votes0
answers28
viewsProblem while extracting zip file - Zipfile
Remaking the question in an attempt to make it clearer. A webhook calls my API by sending a POST request. On the request body contains the url of a ZIP file. Using the requests library, I perform a…
-
0
votes1
answer101
viewsData similarity with various pandas values
I have the following list of pandas The objective of the program is to obtain the degree of similarity according to the entered data. in this case it is a program to query houses, and I have already…
-
0
votes1
answer370
viewsGroup by com Python[Nympy or Pandas] - Bring the 1st line and last line by date
Good afternoon forum colleagues. I’m having a hard time bringing the 1st line and the last row grouped by date. However, I would like to bring this data in the format I am using group By in sum or…
-
0
votes2
answers38
viewsDeleting item from a list without knowing its index - Python
Let’s say I have the following list: lista_de_dados = [['nome', 'prioridade', 'hora', 'consultório', 'Número na fila'], ['Gabriel', 'Comum', '16:30', 'Dermatologia', 1] ['Gabrielle', 'Preferencial',…
-
0
votes0
answers20
viewsHow to write date and current time in Selenium
I would like to know how to include the current date in PT/BR format as in the example: 21/07/2021 and a specific date such as: 01/01/2020 from selenium import webdriver from…
-
0
votes1
answer34
viewsHow to get a full URL using Django?
Is there a Django function that concatenates a specific path with the base URL and returns a full URL? Example: url_completa = criar_url_completa("/meu_app/minha_view") print(url_completa) #…
-
0
votes0
answers25
viewsHow to automate the execution of Python scripts in Google Colab? Sheduler
I developed a python script to automate data requests and integration with Bigquery. I wonder if there’s any way to run this script automatically in a routine from Monday to Friday, always at…
python python-3.x python-requests ipython-notebook schedulerasked 3 years, 4 months ago Fhelyp Guimarães 1 -
0
votes1
answer128
viewsSelenium Basic Python
Greetings, I am beginner in Selenium and follows below my script: from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import…
-
0
votes1
answer1113
viewsWhat is the Sklearn Standardscaler() function
The code below found in the link Classifying the Iris Data Set with Keras. And I’d like to understand the usefulness of Standardscaler(), says it is important for convergence? from sklearn.datasets…
-
0
votes2
answers107
viewsHow to partition people in a network of friends?
In your class, many students are friends. Let’s assume that two students who share a friend should be friends; in other words, if students 0 and 1 are friends and students 1 and 2 are friends, then…
-
0
votes1
answer80
viewsAdd elements in Dictionary and convert them to string
Hello, I am doing some tests with Scraping using the library "Beautifulsoup" python and I came up with a question. I was able to extract some information from a site like product title, sku, and its…
-
0
votes0
answers16
viewsTkinter Python - Json + Entry
I am trying to create a window with 3 Entry, and 2 buttons, one to open a JSON and load some data into these entrys and the other button to save the changes in JSON. Save button and Entry positions…
-
0
votes2
answers212
viewsError while installing Spacy
When I try to install Spacy, I get this error: ERROR: Command errored out with exit status 1: command: 'C:\Users\joaov_pu5ho3m\AppData\Local\Programs\Python\Python36-32\python.exe'…
-
0
votes2
answers69
viewsHow to compare several different terms in a simplified way in Python?
I wanted to know how to show that several terms are different from another term, without having to keep repeating ? As in the example: if termo1 != valor_aleatorio and termo2 != valor_aleatorio and…
-
0
votes1
answer46
viewsRegex python to find all values with Math in Brazilian currency
I need a regex to find all the monetary values of Brazil, I have done several researches and test but I could not reach a satisfactory result. 1.566.545,00 = True 154.565,00 = True 22.555,00 = True…
-
0
votes1
answer3450
viewsHow to read an excel table in pandas by skipping the first lines without losing information?
Hello, I have a problem to solve a little complicated, I have several xls tables in which I have to remove some data, these tables are with their content organized strangely... TEXTE TEXTO TEXTO…
-
0
votes1
answer24
viewsSort data in dataframe pandas by repeating frequency of each element
I have a dataframe and I want to organize the data by the frequency of appearance of each element. From the most repeated to the least repeated, to create a ranking. I want the organization to be…
-
0
votes0
answers24
viewsWhat is the difference between method and instruction?
I am studying python, and I have seen something I am in doubt, when I add something to a list, I use .(point) but when I delete no, it says it’s a method, when I use .(dot), example:…
pythonasked 3 years, 3 months ago Estudante Mayckson 1 -
0
votes1
answer170
viewsReturn returns only the first value of the list (python)
I’m creating a bot in the Discord that displays the films available in the cinema. It turns out I already had a Web Crawler in Python that did this, and I decided to put it to work on the bot by…
-
0
votes1
answer31
viewsIs it possible to replace certain values with NA in pandas without the use of loops?
I was studying data cleaning, and I saw that sometimes there can be int values in columns that should be string and vice versa, so the solution given by the author of the publication I was reading…
-
0
votes2
answers123
viewsHow to find a string in a python txt
I wanted that with this code I could go through my txt file and show all the same words (which is autonomy). I don’t know if it’s possible and the only way I can is to make a…
-
0
votes3
answers222
viewsre.error: bad escape c at position 0
I’m trying to make a search between arrays, and return the value when it is corresponding, and when it is not. import re array = ['brasil','argentina','chile','canada'] array2 =…
-
0
votes1
answer80
viewsHow to draw random numbers repeatedly so that the same number is not drawn?
from random import randint # Dados lista_tentativas = list() quantidade_tentativas = 0 # Entrada de dados x = int(input('Informe um numero entre 0 e 10:')) # Tentativas while True: y = randint(0,10)…
pythonasked 4 years, 11 months ago João Paulo 1 -
0
votes1
answer355
viewsChatbot respond only when a specific word is contained in the sentence
I’m creating a Chatbot in Telegram that can answer questions from group users. The bot needs a keyword to start chatting. That word would be his name, "Joker". Thus, only when the word Joker is…
-
0
votes1
answer59
viewsKeysorting using Ordereddict?
The code below shows that the elements are ordered with odd keys in descending order and those with even keys in ascending order, but are not being ordered according to the rule. from collections…
-
0
votes1
answer68
viewsDjango filtering of timestamp transactions
I am having a logical problem trying to perform a data filtering on Django. According to the code below, I am trying to filter an object inside my database: class…
-
0
votes0
answers108
viewsOserror NLTK Forest labeling
I’m doing tests with NLTK for chatbot, and I ended up having an error when I tried to tag a phrase using the Forest after mining data from the internet (this error is also when I tested without the…
-
0
votes1
answer182
viewsRounding of decimal places float python
Hello, I am starting now to learn programming and I made a calculator that makes the calculation of the formula Bhaskara and it has interface, I used the Tkinter. My doubt is the following I wanted…
-
0
votes1
answer40
viewsHow do I initialize a list with x positions in Python?
I want to create in the list x empty positions before filling, as I do?
-
0
votes1
answer14
viewspivot_table of frequency
I want to build a pivot_table on pandas that counts frequency. For example, I have a sex column, with 2 options, one of UF, with 5 options, and one of color, with 4 options, I wanted to make a table…
-
0
votes0
answers15
viewsHow can I using the installed library add a list of profiles? at this point I have to add one by one
I know it is possible using profile_list['profile1, profile2,.. '] but when I try to do this in my code it does not work. What I do? from instaloader import Instaloader, Profile import instaloader…
-
0
votes1
answer1805
viewsHow does pivot table work on pandas?
I’m new to data science and I’m trying to use the Dataframe.pivot() of the Pandas to create a heatmap but he’s returning me this mistake: Valueerror: Index contains Duplicate Entries, cannot reshape…
-
0
votes0
answers42
viewsProblem: Python 3.8 in Visual Studio Code in terminal Does not accept Accents, How to Resolve ? Linux Ubuntu 20.4
I’m with this problem, I tried to change the settings in visual Studio Code and nothing, I did not find anything on the internet about it, outside the terminal the Apare accent normally now in the…
-
0
votes2
answers651
viewsFilter column by string specifies
I’m trying to perform a filter on my dataframe (df_movies_usa) to eliminate all other types of currency not represented by "$". The coin is in the column df_movies_usa["budget"]. I’m using the…
-
0
votes0
answers125
viewsHow to get all files used on a page using "requests"?
As we know, when accessing a website by browser, various files such as images, music, scripts, CSS, among others, are downloaded to be used within a page HTML. Using the library requests, it is…
-
0
votes1
answer20
viewscreate array through a python file
I’m a beginner in python, and I’m trying to create a code to display login information, in a text file the information is saved like this: 13:30, Gabriel Santana, 12345678 in the case what is saved…
pythonasked 3 years, 3 months ago Gabriel Santana 9 -
0
votes1
answer58
viewsPick numbers with decimals from a xlsx spreadsheet and convert in hours in python
This number 25.0555556, if formatted in Excel [h]:mm:ss, represents 601:20:00, how to get Python to read in hours. I work with a spreadsheet that looks for a report from a system and converts it…