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
answer711
viewsScroll Down Python and Selenium
I’m running a boot to collect information from Facebook for a political survey. However, when I collect the comments I’m not getting the Scroll Down of the page. I’ve tried several code formats, but…
-
0
votes1
answer237
viewsLoop Selenium Phyton
Hello! I started studying Python and I’m trying to make web scraping on the OLX site. I can search and filter. But how can I make a loop for him to click on all the ads so I can pick up the phones?…
-
0
votes1
answer328
viewsChange the maximum values on a bar chart in Seaborn(barplot)
When I go to "plot" a bar chart it modifies my values on the Y-axis proportionally , but I want them to stay with the real values they have in the dataset, as I change this configuration? dataset:…
-
0
votes1
answer323
viewsCalculate the average of a variable for each type of flower in a column
In the Species column of the dataset, I have these flower species: df['species'].unique() output: array(['Iris-setosa', 'Iris-versicolor', 'Iris-virginica'] I need to average for each flower species…
-
0
votes1
answer81
viewsHow to use a collection as an element of a Python array?
I am developing a project using scikit-Learn (and pandas to handle the data) to predict the results of football matches based on previous results. As a project methodology, for each row of the…
-
0
votes1
answer45
viewsConstruction and Class Abstraction
I am developing a small project that takes care of organizing and controlling the daily sales of a retail seller. Basically the user will impute their sales and kpi’s and the application will try to…
-
0
votes6
answers444
viewsCounting multiples of an integer is giving very different values than expected
When receiving two integer numbers, I have to show how many multiples the number n1 (typed 3) has until you reach the n2 (typed 44). The right result should be: The number 3 has 14 multiples smaller…
-
0
votes0
answers749
viewsHow to order date column in ascending and descending order?
Good afternoon, I wanted to order a column in ascending or descending order I have a table (the photo attached)I was able to order the title field in ascending and descending order but now I wanted…
-
0
votes1
answer551
viewsHow to place the value for the y-axis next to the chart marker?
Hello, I would like the figures for the y-axis to appear alongside the points on the graph. Thanks in advance! plt.figure(figsize = (16,8)) plt.xticks(rotation = 90) sns.lineplot(x =…
-
0
votes2
answers436
views1) Read a 10 x 10 matrix and write the location (row and column) of the highest value
CHALLENGE OF THE QUESTION 1 | Now, do not forget to inform which is the position of this higher value. There’s no way I can show the position of the highest value: from random import randint…
-
0
votes1
answer201
viewsHow to loop python code Selenium?
I need to make the comments (["COMENTARIO1","COMENTARIO2","COMENTARIO3"]) if you repeat N times in a random fill, the way I did, no matter how much I put 30 in the range, they are printed 3 times…
-
0
votes0
answers36
viewsHow do I dynamically delete a Row with Flask?
Guys I have this code in HTML {% for row in rows %} <div class="card border-success mb-3" style="max-width: 18rem;"> <div class="card-header">{{ row['title'] }}</div> <div…
-
0
votes0
answers22
viewsPerform Statistical Operations on a CSV File
I’m making a program to perform some mathematical operations inside a CSV file, but I would not like to use pandas, I wanted to do it through a dictionary. Follow the code I’m doing to perform the…
pythonasked 4 years, 6 months ago Pedro Paes Siniscalchi 33 -
0
votes1
answer166
viewsPython: Web Scraping with dynamic values
I am learning about Web Scraping, I have already managed to do some actions but I came across problem in a dynamic page where values are changed every refresh. Unfortunately I can not pass the…
-
0
votes1
answer85
viewsTraceback (Most recent call last) Math Domain error
import math a = float(input("Digite 'a': ")) b = float(input("Digite 'b': ")) c = float(input("Digite 'c': ")) delta = b**2 - (4*a*c) if(delta < 0): …
pythonasked 4 years, 6 months ago João Couto 1 -
0
votes1
answer81
viewsColor Bar Values in Matplotlib
I have a code with 3 variables: a1, a2 and dc1.The variable dc1 is the absolute difference value of a2 and a1. I am generating a graph in matplotlib with the values of the a1 variable and would like…
-
0
votes1
answer138
viewsHow to filter records per month in Python / Flask
Hey, guys. All right? I started learning programming some time ago and took advantage of this quarantine to give a gas and manage to create my first system - a voucher/advance manager. It’s simple,…
-
0
votes0
answers98
viewsPredictions from Cross Validation
I am working with a regression problem. I built a Multilayerperceptron (MLP) using Scikit-Learn. I made two predictions...one using MPL using 70% of data for training and 30% for validation.…
-
0
votes1
answer150
viewsHow to delete two related numpy array elements?
My x and my y to plot are: x0_n125n25matriz= [ 3472.222 3501.157 3530.092 3559.028 3587.963 3616.898 3645.833 3674.768 3732.639 3761.574 3819.444 3848.379 3877.315 3906.25 3935.185 3964.12 3993.055…
-
0
votes1
answer169
viewssoma_ll function that receives a list of lists and returns the sum of all numbers
def soma_ll(lista): return lista[0] + soma_ll(lista[1:]) Why doesn’t my test run? def test_600_soma_ll(self): self.assertEqual(soma_ll([1,2,3]),6) self.assertEqual(soma_ll([1,2,3,4]),10)…
-
0
votes2
answers1533
viewsRead python PDF file
I am trying to create a script that reads a PDF identify some points call, then mark the pages that are these keys, and split the page itself. And then make a merge thus generating a new summary…
pythonasked 4 years, 6 months ago Dieinimy Maganha 13 -
0
votes1
answer194
viewsDjango returning wrong time in the template, why?
I saved in my bank a date, in a field of the kind datetime(6), the date saved in the database is: 2020-05-13 14:13:50.000000, however, when I try to print this date in the template using {{…
-
0
votes1
answer54
viewsLooping ignores the rest of the program
I was writing a program to calculate Paypal fees to help some friends of mine, but in my section against user faults, if the input is not specified, the looping simply ignores the rest of the…
-
0
votes1
answer475
viewsInput with equal class Lenium
I am trying to fill out an online form automatically and the fields are in the same class, using Selenium and python I can fill in the first field with the campo01 =…
-
0
votes1
answer41
viewsThe Program does not advance
I hope you are well! I have tried to make a system that asks for registration and that after confirmation of it, walks to the login screen. Soon after doing the same, new options will appear. The…
pythonasked 4 years, 6 months ago Lorran Rocha 21 -
0
votes1
answer26
viewsBest way to delete a sample from a Dataframe at the same time save it in a variable
Hello, I’m starting in supervised learning and want to separate one sample random of my dataframe for testing leaving the rest for training. I got the result I was hoping for, but I’m uncertain if…
-
0
votes1
answer207
viewsNoreversematch at /view_clients/
I want to print out a simple customer sheet inside a list of customers I’ve registered in the app. When I click on the link to generate me returns this error: Noreversematch at /view_clients/…
-
0
votes1
answer138
viewsHow to save Unicode text in a . JSON file without escape sequence?
I am creating a program where I need to save in a JSON file a dictionary that contains strings with Unicode characters. See the example below: import json data = {"face": "( ͡° ͜ʖ ͡°)"} with…
-
0
votes3
answers1128
viewsModulenotfounderror: No module named 'sklearn.externals.Six'
I cannot run the script, because it is accusing that there is no module 'sklearn.externals.six'. I’ve looked for solutions, I’ve remade the venv and not the right one. Has this module become…
-
0
votes1
answer152
viewsdowload location - Selenium Firefox + Python
I can’t change the default download location in Firefox using Selenium the code is like this: from selenium import webdriver fp = webdriver.FirefoxProfile()…
-
0
votes1
answer305
viewspygame installation error in vs code
When installing pygame no vs code by the console and it returned me the following: pip install pygame Defaulting to user installation because normal site-packages is not writeable Collecting pygame…
-
0
votes1
answer59
viewsHow to replace one layout with another in Qhboxlayout?
I created two Qgridlayout, with 16 buttons each, numbered from 1 to 32. I stored the two Qgridlayout in a list (one at each list position). This list is inserted into a Qhboxlayout to display the…
-
0
votes1
answer162
viewsNoreversematch at /
I’m taking some Python lessons with Django and is making this mistake: py. from django.urls import path from . import views app_name = 'courses' urlpatterns = [ path('', views.index, name='index'),…
-
0
votes3
answers1877
viewsProblem using python Selenium click()
Hello, I’m starting to use Selenium. I started trying to access google and some basic commands. However I can’t use click(). My show: from selenium import webdriver class Google(object): def…
-
0
votes0
answers122
viewsHow to sum up a field of different classes and different apps?
Hello, I have a class in a Django app called product: class produto(models.Model): descricao = models.CharField(max_length=150) quantidade = models.PositiveIntegerField() valor =…
-
0
votes1
answer78
viewsDoubt on the Setter
class Bola: def __init__(self, cor, circunferencia, material): self.__cor = cor self.__circunferencia = circunferencia self.__material = material @cor.setter def cor(self, cor): self.__cor = cor…
-
0
votes2
answers118
viewsPython move files to sub-folders of single name
good night! on the study level, I am trying to create a script with the following rule: what I’m trying to do is: -inside the 'source' folder will have dozens of files. -i need python to move the…
pythonasked 4 years, 6 months ago hanspereira 1 -
0
votes1
answer65
viewsMatplotlib graphics are overwriting themselves
I’m trying to generate a report with several charts generated by matplotlib, however, I realize that after generating the graphics they are overwriting others that have already been created, follows…
-
0
votes1
answer112
viewsPython parallelization slower than serial
Hi, I’m trying to learn a little Python parallelization to parallelize some loops for. I’m using the joblib. However, the first example I made, available on the library’s own website, does not seem…
-
0
votes1
answer42
viewsWhat is the need for this variable in this loop?
I made a simple program in Python that renames with a random number all the files in the folder in which the program file is. After some attempts and mistakes, I noticed in some examples of the…
pythonasked 4 years, 6 months ago KalebLight 27 -
0
votes1
answer240
viewsReturn the value from within the Selenium execute_script
Hello, I wrote this code below, and I would like to return the value of the drive.execute_script. I know the value is 3 from the console.log(i), but this value can change, and I want to go back…
-
0
votes1
answer35
viewsInstall the Six package in the python3.7 project
I’m trying to install that project on my computer, but I’m not getting I already installed python3.7 and when I execute command sudo python3.7 setup.py install, I have at the end the following…
pythonasked 4 years, 6 months ago adventistaam 3,354 -
0
votes2
answers503
viewsHow to make python3 recognize the emoji module?
I did the installation of the emoji module with sudo apt-get install python-emoji After installed, I confirmed the installation with pip install emoji I get the message Collecting emoji Installing…
-
0
votes1
answer84
viewsExit of a Recurrent Neural Network with Tensorflow and Keras
I set up a dataset with my image data. I want to do convolutional neural network training but I ended up stopping at the exit layer of the network. The idea after training the network is to generate…
-
0
votes1
answer32
viewsCan I convert the output of an object using get()?
How do I convert the output of an object when using the get() function? Since it always returns a value string. Here’s a code I’m writing: import tkinter as tk import Sistema_backend top = tk.Tk()…
-
0
votes1
answer110
viewsForm label is not shown on the #Django page
I created a customer registration form and in the meta class I declared the Fields and their respective Abels. However the label 'CPF' referring to the field 'n_cpf' does not show on the page, only…
-
0
votes2
answers769
viewsJSON request on Instagram
I’m trying to get comments from instagram posts. With the code below, I can catch a json with some information about the post through the post link with a parameter __a=1:…
-
0
votes1
answer446
viewsImages disappear in Heroku after a while
I made a website for a newspaper in Django. I have deployed to Heroku and there I have a news register, where I have the title, summary, content and date fields. According to the model: class…
python django web-application heroku django-templatesasked 4 years, 6 months ago Gustavo Augusto Pires 13 -
0
votes2
answers28
viewsOrdering result
Good evening, I need help making a word sorting of that code. texto = '''amar e viver, Amar é sonhar, sonhar é viver, viver é curtir, curtir é amar''' def converte_texto(texto): pontuacao =…
-
0
votes1
answer29
viewsEscaping SQL "ILIKE" using bilbioteca psycopg2
I followed that topical here in the stack to try to create a select in which I look for a person using the ILIKE function, but I have the return of "None", even making changes in the column and…