Posts by Leonardo Araújo • 113 points
10 posts
-
0
votes0
answers15
viewsQ: Restrict type of argument from a Python method
I need to define a class in Python, which will receive a series of parameters. I would like to make the methods receive arguments of a certain type. An example of the code: class Teste(): def…
-
0
votes1
answer41
viewsQ: Copy Macro between VBA files
Hello, I have a file (I will call WB1) in Excel, with two macros. One of them (macroA) does a data processing and formatting. The other (macroB) creates a new file . xlsm (WB2) and copies some data…
-
1
votes1
answer280
viewsQ: Place numbering on graph curves (matplotlib)
I have a code in Python for the simulation of a mathematical model that I am studying. To generate the graphics, I am using only the function plot() of the matplotlib, inside a for (are several…
-
1
votes2
answers53
viewsA: Printing lists
Your list is being returned to the main function, not printed, so in the main code you should have something like: sua_lista = produtos_pedidos(produtos, pedido, quantidade) Then the list that was…
-
-2
votes1
answer42
viewsA: I cannot make two modules of the same package "recognize"
I may be wrong, but I believe that if you import the Point class at the beginning of the functions.py code, it should work.
-
0
votes1
answer69
viewsA: image processing (KNN classifier) - python
The problem there is with the dimension of the parameters you are going through. Without the data and code you used it is difficult to know exactly what to do, but try to start with the suggestion…
-
1
votes1
answer37
viewsA: Matlab: how to write a function that takes a number n and returns P = 1*1.2*1.4*.... *(1+0.2*(n-1))
If I understand your question, it’s something you need: function [P] = repeat_prod(n) P = 1; for i = 1:(n-1) P = P*(1+0.2*i); end end In defining the function, what is between [] is what will be…
-
1
votes2
answers120
viewsA: How to extract data from a single column list and generate another?
I managed to get to that code for your problem: result = [[], []] for p in range(len(output)): if '0x8100.' in output[p]: result[1].append(output[p][output[p].find('0x8100')+ 7 :…
pythonanswered Leonardo Araújo 113 -
0
votes1
answer94
viewsA: Program for process automation
If I understand what you want to do, I have found the following solution: resultado = [] for row in range(0, len(df.index)): menor = df.iloc[row, 0] col_menor = 0 for col in range(0,…
-
1
votes1
answer83
viewsA: Where is the Output error?
Looks like your CSV is split by a semicolon (';') and not by comma (','), which is the standard of the function read_csv, just use the parameter sep=';', as follows: df =…