Posts by danielbb • 425 points
14 posts
-
2
votes1
answer246
viewsA: Generate random numbers with fixed total python result
As suggested by Anderson in the comments, you calculate just x3 = total - x1 - x2 However, note that when changing the calculation of x3 and maintain the calculations of x1 and x2 as it stands, the…
-
1
votes1
answer251
viewsA: How to use the set() function in a list of lists or in a list of tuples?
Observe the code a = [0, 5, 2] b = [7, 3, 2] c = [1, 2, 3] listaDeListas = [a, a, b, c, a, c, a, c, b] print(len(set(listaDeListas))) Its result is Traceback (most recent call last): File…
python-3.xanswered danielbb 425 -
1
votes1
answer601
viewsA: How to use the . replace() function in a list of lists or in a list of tuples?
If I understand the goal, you want, from list, to iterate over all its elements, without comma. For this, just correct the line: remove_final= remove6.replace(",,","") for remove_final=…
python-3.xanswered danielbb 425 -
0
votes2
answers93
viewsA: Runtimeexception when using colorbar() Spyder IDE
I suspect there’s a call to show shortly after pcolor for: A graph is displayed The function show "consumes" the graphics made previously - and therefore it is natural that the call to colorbar…
-
4
votes1
answer229
viewsA: Python Multidimensional Array Problem
In my experience, this occore when matrices in x have different sizes, and so the conversion to vector numpy group only the first dimension. Among the reasons that may have caused this problem are:…
-
0
votes1
answer298
viewsA: Import images from a Python folder in the same format as MNIST
According to the documentation of the MNIST dataset, the dataset image data type is a grayscale image array, with color depth 8-bit. A convenient way to load images is to use the function…
-
2
votes1
answer157
viewsA: Help with first neural network
Input Data 0 empty, 1 normal piece, 3 queen. Positive or negative symbolizes whether it is allied or enemy Is called categorical variable, the variable that holds data that assumes a limited number…
-
2
votes1
answer761
viewsA: How to create a dataset to work with Keras classification
When using a monochrome classifier, it is necessary, in some way, to discard information. I imagine that you are searching with the reshape, discard any two channels and pick one up. The problem is…
-
1
votes1
answer2511
viewsA: How to loop a dataframe by conditionally removing lines and restarting the loop in a recalculated dataframe at each removal?
Reproducing the defect Note the following code import pandas as pd df = pd.DataFrame( [ [6, 5, 7, 3], [1, 7, 8, 9], [7, 8, 3, 10], ], columns=list('ABCD')) # Condição de remoção: uma linha deve ser…
-
1
votes1
answer155
viewsA: Code to generate continuous beep
The most practical way to keep beeping using winsound, is to separate the part that checks the logical condition from the part that makes the sound: import time import winsound def monitorar(path):…
-
2
votes1
answer143
viewsA: I cannot return assigned values to variables
The problem is in the number of arguments of the cost function. Note the code below: def teste(a,b): print(a) print(b) if __name__ == "__main__": #O código abaixo será executado caso o programa seja…
-
3
votes1
answer255
viewsA: How do I see how much the function returns Python
This is because your program is not returning players, just printing their names. You can assemble a list (in the example done with list comprehension), use it as function return, then get its size:…
-
0
votes1
answer132
viewsA: Style of a program’s widgets using Pyqt5
Well, I found that repository which has other widget styles that can be loaded, and also the style sheets which can modify widget styles.…
-
0
votes1
answer132
viewsQ: Style of a program’s widgets using Pyqt5
I have been creating a kind of text editing software using python3.5 and pyqt5, and at the stage of creating the packages I ended up noticing that the development version, which used a Pyqt5 package…