Most voted "python-3.x" questions
Python 3 is the latest version of the Python programming language and was formally released on December 3, 2008.
Learn more…3,274 questions
Sort by count of
-
0
votes0
answers190
viewsInsert data into Postgresql using Dataframe Pandas
Prazados, I am working on a particular project in which I want to do an ETL with Python and Postgresql. I intended to consume a GET API using request, persist this data in a Dataframe and after…
-
0
votes1
answer270
viewsHow to iterate with Python 3 dictionaries?
I have two files and need to generate a third from them. First file called "de_para". de_to.txt Inside this file I have the following sample content: Ordem Campo_para Campo_de 1 nome_emp RAZA 2…
-
0
votes1
answer83
viewsError in python exec command
I’m trying to accomplish an action through command exec(): import asyncio from pyppeteer import launch async def main(a): #função que executará o comando exec(a) c="""browser = await launch()…
-
0
votes1
answer22
viewsError of procedure call
I’m having a problem calling one procedure within a function in the SQL. When I call the function CHECK_LOGIN for SGBD, does the operation without any problem, but I need to do this operation by a…
-
0
votes1
answer1645
viewsCumulative sum per line
Good afternoon colleagues I would like a help. In the code below i Gero a new column (accumulated) using cumsum. The result is a cumulative sum for each row. However I need to bring the accumulated…
-
0
votes2
answers136
viewsHow to do continuous firing in python?
Good afternoon. I am developing a project where I need to make two cameras to take sequences of photos and stop only after a pre-defined command. In my current code you need to decide the number of…
-
0
votes1
answer90
viewsExercise - Calculation of bhaskará
a=int(input("Digite o valor de A: ")) b=int(input("Digite o valor de B: ")) c=int(input("Digite o valor de C: ")) delta=float(((b**2)-4*a*c)) r1=float((-b +(delta ** (1/2))/2) r2=float((-b -(delta…
-
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, 3 months ago Fhelyp Guimarães 1 -
0
votes0
answers10
viewsWorking with Multiple Flask python Request
Hello, I’m new to developing Python applications using Flask, developed an application using Python and Flask, hosted the application on the Google Cloud App Engine, and came across a problem, in…
-
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
answer478
viewsAdding and sorting row of matrices in python
The program below generates a random matrix, according to the amount of lines desired. def gerar(nLins, nCols, min, max): from random import randint vals = [None] * nLins for i in range(nLins):…
-
0
votes1
answer119
views2 decorators in a Python method
Well, I have a very simple class called Task, where I want to store my tasks and then save in a bank. However, I want to go through the types of my attributes, I would like the task_name attribute…
-
0
votes0
answers15
viewsHow to limit the decimal places in Python to { } . format?
controle=int controle=1 while(controle!=0): cel=float(input("Informe a temperatura em Celsius para convertemos para Fahrenheit \n")) ctofa=float ctofa=(cel*(9/5)+32) #inserir dentro dos { } a…
python-3.xasked 3 years, 2 months ago Carlos Nascimento 1 -
0
votes0
answers275
viewsSplit dataframe according to number of lines
I wonder if it is possible to separate in a way a date frame of +- 300000 lines in pre-set amounts of lines and save in xlsx as the headers each part. I thought of using Loc, but I would have to use…
-
0
votes1
answer177
viewsFunction to print directory on a Python Label
I created a function that opens a file with Tkinter + filedialog, so far so good. But I need to print the directory of the selected file on a label. Follows function: from tkinter import * from…
-
0
votes1
answer138
viewsJO KEN PO’s game gone wrong
I’m trying to make a game of jokenpo but it’s gone wrong. from random import choice from time import sleep print('[1]PAPEL\n' '[2]TESOURA\n' '[3]PEDRA') escolha = input('Qual a sua escolha? ')…
-
0
votes1
answer635
viewsHow to get n working day of the month?
I’m creating a data model for Machine Learning to get a transaction amount forecast per year/month/day/hour. But I am needing to map the 5th and 10th working day of the month so that my algorithm…
-
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
answer45
viewsError outside the list range
I have a problem, I have 3 files that I need to open and get information from them, move to a list within the list (matrix?!) and compare information from 2 lists with another list to validate…
-
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…
-
0
votes0
answers46
viewsPython script to calculate a series
Data n, print the value of Sn = 1/n + 2/(n-1) + 3/(n-2) + ... + n. This is what I tried to do: n =2 soma =1 for i in range(1,n+1): if n>i: soma+=i/n + i/(n-1) But it only works when n=2. Someone…
python-3.xasked 3 years, 2 months ago Ed S 2,057 -
0
votes0
answers36
viewsHow to update a key slice (key) of a Python dictionary?
How do I update just a slice of a key in a Python dictionary? I am scraping a page and would like to format the result so that my key is on the same line as my value, for example: Air Conditioners:…
-
0
votes1
answer390
viewsDisplay number that most repeated and its quantity
I have the following code: def repetido(numeros, count): for i in range(len(numeros)): count.append(float(numeros[i])) for x in range(len(count)): aux = count.count(count[x]) if aux > count:…
-
0
votes0
answers16
viewsReplacing data in lists
def substituir(lista,velho,novo): lista = [1,2,3,3,5] resultado = substituir(lista[velho],novo) return resultado The problem is that I can’t replace an old list item with a new one. For example if I…
-
0
votes3
answers79
viewsSearch python data dictionary
I need to scroll through a Python data dictionary, taking the values and counting the positions from start to end of each value sequentially, then turning it into an example tuple: dict = {'dado1':…
python-3.xasked 3 years, 2 months ago Douglas Mitsue 21 -
0
votes1
answer123
viewsHow to remove background using python and cv2?
I’m a beginner in programming and have some problems trying to remove the background of the image using cv2. The program below runs, however the result is not as expected. I would like to help…
-
0
votes1
answer283
viewsHow to take n in Python file manipulation
I have to create a certain kind of encryption. I read a String and it is converted into ASCII and then written to a txt then in another code I read this txt with the encrypted string to be able to…
python-3.xasked 5 years, 2 months ago Gabriel Do Prado 1 -
0
votes1
answer45
viewsPrint value of a dictionary
I have this issue to resolve, I need to display the note of the first name in the order of the flame, but I can only print the Key, the question is this: Make a program in python that prompts the…
-
0
votes2
answers507
viewsChange List with a python function
I’m developing some book exercises "Intensive Course of Python" but I stopped in the proposed 8.10 exercise: EX: 8.10 - Great magicians: Start with a copy of your program from Exercise 8.9. Write a…
-
0
votes1
answer106
viewsHow to set a timeout for the Python recv() method?
I’m creating a program in Python using socket, and I came across a bug in the program that occurs because the recv does not inform if the connection has been terminated or not. Someone there can…
-
0
votes0
answers22
viewsIs it possible to establish a download directory with urllib.request.urlretrieve?
I am trying to set a default download forwarding directory after using urllib.request.urlretrieve, to avoid having to move the file with and shutil. Does anyone know if it’s possible and how to do?…
-
0
votes0
answers17
viewsWhen I call python Manage.py migrate from this problem and because of pycham?
When I am to test the database (Sqlite3) always gives this same error. remembering that I am not using a database for production, because this system is only for training.…
-
0
votes1
answer63
viewsDjango, special characters for HTML with content saved in the database
Good morning, I have contents saved in HTML database: Field: content <p><img src="/media/django-summernote/2019-08-26/2ed93bb9-8293-4b98-9ccb-eeba931421b5.png" style="width: 255px; float:…
-
0
votes0
answers217
viewsHow to make a socket connection using Hamachi in Python?
I’m trying to connect with socket on another network with Hamachi. When creating the server, I am using the local IP and when connecting I am using the Hamachi IP. See my code below: # Código do…
-
0
votes1
answer486
viewsProblems with Urls in Django
Expensive, I’m with the following mistake my project: django.core.exceptions.ImproperlyConfigured: The included URLconf 'api.urls' does not appear to have any patterns in it. If you see valid…
-
0
votes1
answer47
viewsProblems with input_shape using Keras
Hello, I’m trying to make my first ANN code to predict the price of homes. I have separated the datasets into training and testing, however, I am finding some problems when compiling my code below:…
-
0
votes0
answers30
viewsDo you need python installed to build a Docker image?
On the Docker website, examples of build with Python, Java, Go, Node.js(javascript) are given and they are indicated to have previously installed them. What do I see, I have to have the language…
-
0
votes0
answers34
viewsHow do I have my application already implemented in Heroku present the filefield of Django?
In my localhost my app works fine, but when I do deploy in the heroku it does not show uploads of my. pdf files MODEL.PY from django.db import models from django.contrib.auth.models import User #…
-
0
votes1
answer132
viewsHow to handle "Nan" values returned from a Dataframe
I wrote the code below to select 1 column of each CSV file, but it returns all values like NaN. How I treat it so it returns the right values? import pandas as pd df1 = pd.read_csv("CSSS.csv",…
-
0
votes1
answer815
viewsSave array to python CSV
I wrote the code below to store some data in a dataframe, soon after I converted it into an array, but when saved the same in CSV file, the same jumps lines in saved file import pandas as pd import…
-
0
votes1
answer78
viewsError 404 on second route using Flask
Good morning. I configured my app in Cpanel that uses passenger_wsgi.py (I don’t know if this information is relevant) Python Version 3.7.3 and Flask Version==1.1.1 The main route works well, but…
-
0
votes1
answer39
viewsFile list gives errors when going through . Decode()
In the following code for file transfer using Python sockets: Client: lista_arquivos = ['C:\Users\fulano\Imagens\passaro.jpg', 'C:\Users\fulano\Imagens\cachorro.jpg',…
-
0
votes1
answer126
viewsAttributeerror: str Object has no attribute 'Train'
Context I’m replicating an algorithm of neural network of the kind Single Layer Perceptron (simpler neural network model). I used the library Tensorflow and wrote the code based on the documentation…
-
0
votes2
answers2088
viewsI type the correct xpath from a button, but Selenium says xpath does not exist
I’m making a bot in python using Selenium and need to click the Instagram like button using code. To find the Like button I’m using the method find_element_by_xpath(). To make sure, I clicked on…
-
0
votes1
answer658
viewsRender JSON data received from an API in an HTML/Django Table
Friends, I need your help! I am new to Python/Django and I am doing this project with the knowledge that I acquire in day-to-day studying. I have a function in my views.py that communicates with an…
-
0
votes1
answer150
viewsHow to encode a number with the notation x and not 0x
Problem I’m performing a serial communication in which the checksum the message needs to be sent or verified upon receiving. This must be checked with a XOR logic, which returns an int number, given…
-
0
votes1
answer70
viewsConversion of PDF images with Python
I am trying to convert all images from a directory into a single PDF. However I am having difficulties. When I run my system it gives the error below, it tries to read the file . py also. from PIL…
-
0
votes1
answer146
viewsHow do I run a web routine within Tkinter without crashing the mainloop?
Good day I created an application by Tkinter and now I’m trying to make the information on the web available to users in real time. The problem is that the app.run function does not let you run the…
-
0
votes2
answers115
viewsHow to return attribute value X - in a Manytomanyfield
I have some classes that relate to each other. Ex: I have an Activity class that has a M2m relationship with an Activity class. And I have another structure class that has a 1to1 with…
-
0
votes2
answers1550
viewsDraw Inside a Python String
I am doing a program in Python, whose statement is as follows:: Create a function that takes a string and turns some of the characters into uppercase and others into lowercase. I need the user to…