I want to split a folder of image into train and test using python split-folders and i gave a zero in second part which represent validation, the problem is that the original folder contains 155 images and the splitting gave 57 in train and 56 in test so idk where are the left 42 images ? this is what i
Tag: python
How to relate size parameter of .scatter() with radius?
I want to draw some circles using `ax3.scatter(x1, y1, s=r1 , facecolors=’none’, edgecolors=’r’), where: x1 and y1 are the coordinates of these circles r1 is the radius of these circles I thought typing s = r1 I would get the correct radius, but that’s not the case. How can I fix…
Pyinstaller Error when try to create exe file
When i try to create the executable for my program using pyinstaller –onefile gui.py it gives me this error. pyqt5 and all the required packages are installed for the program but when i tried to create the executable it gives me this error what is wrong with the process Answer Finally i found a solution…
How to get the seven segment output side by side in python?
I have written a code to display the seven segment output. Whereas I need to display the output side by side. Say input: 123 , output should display seven segment side by side as below Here is my logic: Answer Try the following: You need to print the segments side by side, so you should start by printing the …
Represent string characters as hex values in python
I’m trying to represent a given string in hex values, and am failing. I’ve tried this: For the first one I get “ValueError: non-hexadecimal number found in fromhex() arg at position 0” error For the second I get that there’s no decode attribute to str. It’s true but I found…
Python unittest AssertionError: 0 != []
I’m new to Python unittest and I’m trying to access this list: to do this test: I’ve created this function: But I keep getting this error: AssertionError: 0 != [] Can someone help explain what I’m doing wrong in the function please? Answer Let’s take a look at this part, the get_…
Is there a way to get the count of every element in lists stored as rows in a data frame?
Hi, I’m using pandas to display and analyze a csv file, some columns were ‘object dtype’ and were displayed as lists, I used ‘literal_eval’ to convert the rows of a column named ‘sdgs’ to lists, my problem is how to use ‘groupby’ or any another way to disp…
The sum of the products of a two-dimensional array python
I have 2 arrays of a million elements (created from an image with the brightness of each pixel) I need to get a number that is the sum of the products of the array elements of the same name. That is, A(1,1) * B(1,1) + A(1,2) * B(1,2)… In the loop, python takes the value of the last variable from
Regex to get part of the string after dot and before hyphen?
I’m new to regex and have tried to get the regex expression in Python for the following string but still no luck. Just wondering if anyone know the best regex to get group1 from: Basically, I was trying to get the part of string after the first dot and before the second hyphen Answer You can just do it …
Wrong result if a recursive function is called twice successively with different parameters
I have this recursive function: When I print this: It shows -1, which is correct. But, when I print this: It shows 3 then 2. As you can see, the result of print(coinChange([2], 3)) weirdly changed from -1 to 2. The memo is the reason for causing that wrong answer. But I don’t know how to update the func…