Skip to content

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…

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_…

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 …