I have checklist form data coming into a spreadsheet that I am trying to determine if a specific value was not checked and provide info based off that. My first thought was to have a master list/df where all the form values are then do a left/right merge on each response to determine values that weren’t…
Tag: python
Trying to split a main window into two in Python
I’m learning Python by trying to build a simple plotting application and would like to have two windows in my main screen. I’m using the QSplitter module but am having no luck so far. I’d like the left portion to be used for inputting information via lineEdit() (for now) and the right to sho…
What is the correct way to run a pydrake simulation “online”?
In Drake/pydrake, all of the examples I have seen create an instance of Simulator and then advance the simulation by a set duration, e.g. sim.AdvanceTo(10) will step the simulation until it has simulated 10 seconds of activity. How can I instead run a simulation indefinitely, where I don’t have a specif…
Remove item from list of tuple with two elements across rows
I have a set of >1000 rows of POS-tagged sentences. I want to remove words that are tagged with “RB”, “IN”, “PRP”, “CC”, “PR”, “DT”, “CC”. Here is my data, the “pos_tag” column shows how my data is now. The R…
Rookie coder: main() missing 1 required positional argument: ‘self’?
This is my first coding class (and first time on the site) and I’m working on a class project. I can’t seem to get my code to run correctly. I’m getting 2 errors and I’ve spent the last 2 hours trying to figure them out. Was wondering if this site would be willing/able to help me out. …
Create Array from Model Data in Django Template in
I am trying to use JQuery date picker and I want to make use of the beforeShowDay method in order to block out dates in the date picker. I have been able to get the widget to work and if I define an array, the beforeShowDay method works flawlessly. But my issue is passing the data from my Django model
List iteration through JSON array with dates (date format conflict)
I’ve been diving into List Comprehensions, and I’m determined to put it into practice. The below code takes a month and year input to determine the number of business days in the month, minus the public holidays (available at https://www.gov.uk/bank-holidays.json). Additionally, I want to list all…
Python Trigger a function when a function is called
So, I am making a desktop app with PyQt6. I have a stylesheet and I want it to update every time I add something to it. Stylesheet is an array and I have multiple functions adding things to it: Now, I want to update the stylesheet every time I call one of these functions (or a function in the class
List comprehension returning two variables
I’m trying to do a list comprehension on two lists returning 2 variables in result. Using for loop: However, when I try to use list comprehension to do the same execution, it throws a SyntaxError Answer You need to have the whole thing in square brackets. Like this: That’s because you are doing th…
Sorting list based on dictionary keys in python
Is there a short way to sort a list based on the order of another dictionary keys? suppose I have: I want to sort the list to be [‘a’,’b’,’c’] based on the order of dic keys. Answer You can create a lookup of keys versus their insertion order in dic. To do so you can write:…