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
answers35
viewsBug images from jupyter notebooks to Github
Hello, could someone help me, please? I am starting to work with the jupyter notebook and I need to push my repository but the notebook with images shows nothing when sending to github. I tried…
python-3.x github ipython-notebook github-pagesasked 4 years, 1 month ago Lineker Aguiar Alcântara 1 -
0
votes1
answer24
viewsAdaptation of csv columns with DB fields other than hard code?
Boom day :) I’m doing a python script that reads a file. csv that takes a few columns (not all columns, just a few) and saves it in the database. As the columns of csv and the name of the database…
-
0
votes1
answer797
viewsAttributeerror: 'module' Object has no attribute 'exceptions'
I’m trying to use the module requests with python but I’m having the following errors: File "/home/santana/string.py", line 35, in <module> except requests.exceptions.RequestException as e:…
-
0
votes2
answers322
viewsSwitch from insertion mode to typing cursor mode?
When I open a new file in Pycharm the cursor is as if I had clicked on the Insert key, someone knows how to solve?
-
0
votes1
answer87
viewsInsert line break based on number of characters avoiding cutting words
I’m starting in Python and I’m struggling with something relatively simple that I’m not able to accomplish, I’d like to add a line break in a string every 13 characters without cutting the words in…
-
0
votes1
answer103
viewsFind div id with variations - Web Scraping - Beautifulsoup
Assuming I have the following div ids <div id='post_message_12932087> <p>random text</p> </div> <div id='post_message_21390123> <p>random text2</p>…
-
0
votes1
answer266
viewsTable in Python
Good night, I need to make a Python function that receives a list of tuples with real dollar and real dollar dollar quotations return a string that, when printed, generates a table of quotations. I…
-
0
votes1
answer322
viewsExtract data from all rows of a file and create a dataframe
I have a file . txt with 2000 lines (Whatsapp chat) from where I need to extract to a pandas dataframe the date, time and sender of the message. I can do this with the function below: def…
-
0
votes4
answers2357
viewsPython - Higher value of a dictionary per key
Good morning to all. I need a lot of help with a project I’m doing. I’m having trouble getting only the highest values from a dictionary or a list. I’ll try to explain it better: In AWK language I…
python-3.xasked 5 years, 5 months ago Cleber Nandi 137 -
0
votes1
answer491
viewsHow to add an image to Kivy Python
I need to add an image to my screen and was following what I was doing in all other widgets. My code: class MainApp(App): def build(self): layout1 = FloatLayout() button = Button(text='iniciar',…
-
0
votes1
answer223
viewsHow to identify files in the same name pattern, which are in a given directory, using Python?
I need to get the Python identify the files I need, and if you are one of them, open for processing: 1) All files are in the same directory, example: (r'C: Users Me Desktop Test File Test…
-
0
votes1
answer73
viewsSingle values average filter in dictionary list
I have the following dictionary list in Python 3.7: a = [ {'linha': 0, 'porcentagem': 1.0, 'id': 3, 'nome': 'bruno'}, {'linha': 8, 'porcentagem': 1.0, 'id': 7, 'nome': 'teste'}, {'linha': 12,…
-
0
votes1
answer37
viewsMongodb does not return query correctly
I have the following code: from pymongo import MongoClient class ConectaMongodb: def conecta(self): client = MongoClient('mongodb://localhost:27017') db = client.starwars_api return db def…
-
0
votes0
answers77
viewsGet Low Consumption within 100m Radius?
I have a database with consumption and coordinates in Excel, like: In this sense, I need to write a code that allows me to find, from place to place, consumptions below the average consumption…
-
0
votes3
answers575
viewsConstruct a program to read positive integer n and print all primes in the range [2, n]
I need to create an algorithm that reads a number and tells you if it’s prime, and then print in a list all primes smaller than or equal to the read number. I made an algorithm that says if you’re…
-
0
votes1
answer64
viewsRemove specific characters from a list
My question is this, is there any way to remove the comma from a list? I’m using the . strip to remove the brackets, but when setting the comma as parameter does not work, I tried . replace but…
-
0
votes3
answers1665
viewsmultiples of 2 and 3 in python
I’m making a code to compute the first(s) n(s) multiples of two values, and put it in a list. until ai perfect but in the list occurs multiple equal numbers, as could take the equal number from the…
-
0
votes1
answer333
viewsFrequency table - Python
Hello, I’m a beginner in the programming area and I’m having difficulty making a frequency table. The table is this: import math import statistics import numpy as np import scipy.stats import pandas…
python-3.xasked 4 years ago Murilo. 11 -
0
votes1
answer235
viewsMaking Predictions using LSTM with Keras
Good morning, group. I’m doing some tests with predictive models using lstm with the keras. In the test that I did, I trained the model with some random data that I found on the internet. Only I’m…
-
0
votes1
answer66
viewsloop for Jinj2 flask
I have a loop 'for" in the template only I want it to show a certain amount result. {% for form in form %} <tr> <td><img src="../static/img/arrow-gray.png" alt=""> <font…
-
0
votes1
answer95
viewsReceive data input as Python 3 literal value
Developing an encryption algorithm, at some point the user will insert the message to be decrypted. The message will be inserted in bytes, in the format…
-
0
votes1
answer293
viewsProblems with win32com
I have the following error in my code, I’ve tried everything and I can’t fix: 1° Attempt - Unsuccessful excel = win32com.client.Dispatch("Excel.Application") wb =…
-
0
votes1
answer19
viewsdtype error on file merge
I need to join several csv files, where the columns are float. I made a small code, but the output of the columns are in str, so I tried to add the output format of the data, but the following error…
-
0
votes1
answer194
viewsHow to activate 2 if’s at the same time in Python
I’m making a bot that plays Guitarflash (Guitar Hero browser) alone, only when I need him to press both keys of notes at the same time (I use pyautogui to press the keys and Imagegrab to detect the…
-
0
votes1
answer26
viewsHow do I use line breaking in the answer?
n1 = int(input()) n2 = int(input()) n3 = int(input()) n0 = (n1, n2, n3) print(sorted(n0)) I wanted the answer to come out in each different line, that is, one below the other.…
python-3.xasked 3 years, 12 months ago Guilherme Araújo 27 -
0
votes1
answer68
viewsHow do I get the input to be on the same line?
I wish that when someone comes in, the input stays on the same line, I tried using the 'split' command, but I could not. D = int(input()) R = int(input()) L = int(input()) P = int(input()) G =…
-
0
votes1
answer243
viewsError importing pandas into Jupyter Notebook
I can’t care what pandas in Jupyter Notebook. Error shows this message: Runtimeerror: The Current Numpy installation ('c: users Augus analise_data lib site-Packages numpy\init.py') fails to pass a…
-
0
votes0
answers166
viewsObtaining and formatting cookies from a request
Guys, in PHP I used so: preg_match_all('/Set-Cookie:\s([^\;]+)/mi', $response, $matches) I took a look at the documentation and tried to follow this line of logic but it doesn’t work: I’m an amateur…
-
0
votes1
answer380
viewstraverse python int lists by skipping consecutive numbers
Guys, I’m trying to eliminate consecutive numbers in a list of integers. When the list is for example 1,2,3,5,6,7,8,9... it show: 1-3, 5-9 I tried many ways and I arrived at that code: def…
python-3.xasked 5 years, 4 months ago Jane 1 -
0
votes1
answer47
viewsProblem when performing the calculation between arrays
I’m building a code that has a very similar structure to the code below. from math import sin, pi from numpy import zeros djn = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] djn = array(djn) def test(djn): M =…
python-3.xasked 3 years, 11 months ago Syner 95 -
0
votes1
answer116
viewsAccess out-of-loop variable for
As access to variable cookies out of the loop? cookies = [] for i in get_cookies(url): cookies = '='.join(i) + '; ' print(cookies) Is just returning this:…
-
0
votes1
answer637
viewsPython: listbox with multiple columns in Tkinter - sort columns by clicking on them
I have a listbox with multiple columns, as shown below. I would like to sort the columns by clicking on the titles of them, see the code: I had thought within the "sortby()" function to identify…
-
0
votes1
answer167
viewsHow to transform an array of arrays into a nested array in python
I’m looking to transfer an array of arrays in a nested numpy matrix, i.e.: array[array[1,2],array[1,2,3],array[8]] in array[ [1,2,nan], [1,2,2], [8,nan,nan] ]. That’s right when I convert to pandas…
-
0
votes2
answers106
viewsHow to check if a certain value of a column is equal and does not save this value in file?
Good afternoon! I’ve been in a jam for days because I can’t seem to make sense of the problem I’m having. I’m making a query to record data in a type str in python. This query goes through the query…
-
0
votes2
answers183
viewsPrint which (ais) words repeat in Python
Hello, how could I know which or which words repeated? For example, I have a.txt file, in which when I open it as . read() and it returns it to me... Alface, Alecrim, Capim, Limão, Alface, Azeitona,…
-
0
votes2
answers151
viewsCalling a service . py inside another . py
Good afternoon, you guys! I researched a lot on the internet and did not succeed, I have the following problem to solve: I have 3 Python services installed on Windows(example1.py / example2.py /…
-
0
votes2
answers47
viewsCompare the values of two lists
So, I just started learning Python and I’d like to know how to compare the values of two lists, more specifically, know the values that match them, example a = [30, 35, 40, 50] b = [25, 35, 40, 55]…
-
0
votes1
answer47
views(Python file manipulation) I’m having trouble checking ip validation, how can I continue the code?
A program that reads a text file containing a list of IP addresses and store invalid IP addresses in an array. Input file: 200.135.80.9 192.168.1.1 8.35.67.74 257.32.4.5 85.345.1.2 1.2.3.4 9.8.234.5…
python-3.xasked 3 years, 10 months ago Elaynne Vieira 3 -
0
votes1
answer75
viewsPYTHON LAYOUT ATTRIBUTE ERROR
I’m doing a project in Python with Pysimplegui using Sg for simple layout, but the Pycharm terminal returns me the error of missing value assignment tried to go through the powershell terminal and…
-
0
votes1
answer69
viewsCreate multiple Dataframes through iteration
Is it possible to create multiple Dataframes within an iteration? I need to do this feat, follow the example: in the NUM iteration, it has numbers from 0 to 9, total 10 numbers. in the for nn in…
-
0
votes2
answers271
viewsPython script run every 1 second for 3 hours in a row
I need to run a Python script every 1 second for 3-4 hours a day. This my script updates the data in a table, performs some calculations and takes an action if the calculation rule determines.…
python-3.xasked 3 years, 9 months ago ToroNero Trader 1 -
0
votes0
answers383
viewsDataframe: Empty 'Dataframe': no Numeric data to Plot
I’m trying to get the highest values in the column Valor Pago. No Jupyter. top_10_empenho = portal[['Descrição', 'Valor Pago']].head(10).set_index('Descrição').sort_values('Valor Pago',…
-
0
votes1
answer63
viewsRed numbers in Visual Studio
I was testing the Python Colorama library and it occurred to me, does anyone know why? I can not run at all, this error appears: print (\033[33m'hello') ^ SyntaxError: unexpected character after…
-
0
votes1
answer81
viewsDelete a range of values in python
I have a code that eliminates values as needed, but I’m not able to put an interval to delete or keep the value. For example, I want values between 7:00 and 5:00. If you put values greater than 18h,…
-
0
votes1
answer601
viewsHow to use the . replace() function in a list of lists or in a list of tuples?
I am new in programming and new here on the site. I have a problem that I can not solve and luckily you exist. I’ve tried everything in my power and I’ve almost found the solution, only it was just…
python-3.xasked 5 years, 4 months ago Juliana Maria 25 -
0
votes1
answer251
viewsHow to use the set() function in a list of lists or in a list of tuples?
I have a list of tuples generated with the Combinations function of the itertools module: from itertools import combinations as comb A = range(x,xx) B = list(comb(A,x) I generated this list of…
python-3.xasked 5 years, 4 months ago Juliana Maria 25 -
0
votes0
answers15
viewsFlash Admin - How to fix or delete a truncated calendar (datepicker)
On the Create New Record page two calendars (datepickers) appear for a date field. One of them is truncated, I believe it is flask_admin. The other was created by form_widget_args, as below.…
-
0
votes1
answer103
viewsScript to detect prime numbers in Python
I decided to create a script to detect prime numbers, but in order to really understand what I’m doing I created something from scratch, something I thought. At first my program worked, but I…
-
0
votes1
answer62
viewsUsing two webdrives in Selenium
I need to develop a script for automation of a website. I get a list of URLs I pass this list on a for that for each item in the list a new one is created webdriver and it asks to login to the site.…
-
0
votes1
answer289
viewsHow to multiply all elements of an array by number in Python?
I need to do a function that given a matrix and a number, returns the resulting matrix by multiplying all elements of the matrix by that number. I tried something like this: def mult(matriz, n):…