Skip to content

Multiple context menu in a single qTableView pyqt5

i added two functions in two different pushButtons. for both function i used a common qtableView. i created two contextmenu, whenever user clicked pushButton1 func1 is called and result set will be shown in qtableView and user can select items from contextmenu1 and same like pushButton2 ,where contextMenu2 wi…

Pandas conditional counting by date

I want to count all orders done by each customer at each order date, to find out how many orders were done at the time of each order. Input: Expected output: The following code works but is extremely slow. Taking upwards of 10 hours for 100k+ rows. There is certainly a better way. Answer Try sort_values to ge…

Start a Thread Timer directly

I want to trigger the self._runSequence() func directly after start the timer. This is my code: If sequenceDuration is equal to 10 the func will be called 10 seconds later (as a normal timer I know..) This is the RepeatedTimer Class: What I already try: But this give me an error when the timer trigger the __r…

comparing numpy arrays with tolerance

I’m trying to compare floating numbers that are stored in numpy arrays. I would like them to be compared with a tolerance and every number of the array should be compared with every number of the other array. My attempt is shown underneath, I used two simple arrays as examples but it has the problem tha…

How to covert a list into a list with sublists? python

I’m making a little data base on python. I want to convert the list into this Is there anyway i can do this? Answer zip will return a tuple from two iterables; if you take the same list, but shifted as you wish (in this case, one element forward) you can have your expected result. Also, the generator wi…

IndexError: list index out of range error on python

This is my code: This is in items.txt: I am getting this error: I am trying to make a program that makes a receipt of items so if you could provide any code that would be helpful. Any help would be appreciated. Answer The problem you have in your code is with the empty strings in your items.txt file. When