Using GNU Radio Companion 3.9.4.0. My application has a “QT GUI Range” block. When the Widget is set to “Counter + Slider” I get the error The Python code for this condition is, With the Widget set to “Counter” there is no error. Now that same Python line is, How can I use …
Make list after groupby in pandas using apply() function
I have this dataframe: My goal is to keep tracking the values in column2, based on the letters of column1 separated by(:), the output should look like this: What’s the most pythonic way to do this: At the moment I’m able to group by the column 1 and I’m trying to use the apply() function, bu…
How do I get a certain response from a certain input
Example = If the person types in 20, say that 20 was NOT the correct answer My current code that I’m trying to work with is: Answer Add an else and use f-strings to insert the user’s input into your response:
How do i make a counter that works for me on django Models
i have a question. i am trying to make some counter for my models. i have model- personeel and kwalification. i want to make a couter that counts how mutch personeel got the same kwalification like if 2 personeel got ehbo then it counts 2. Answer Kwalificaties.objects.filter(ehbo=”wel”).count() ma…
Appending value from a row onto the same row but in a new column when condition in for loop is met
I need to attach the numeric values, whichever is less, from columns, R2ESL or MCL, into a new column, Lesser Value, for each row (ex. A, B, C). For example, for param A, MCL with value of 7 is less than R2ESL with value of 10. I want to get 7 into a new column (Lesser Value), but on the
Get Top N items per month in pandas
I have the following dataframe (which is a pretty reduced sample from my original one). I’m trying to get the top 2 ids for each year AND month. So, for example, the idea was to obtain the below df. My main problem here, is to get the Top n along with the dates, because the nlargest method applies to a
For loops and conditionals in Python
I am new to Python and I was wondering if there was a way I could shorten/optimise the below loops: I tried this oneliner, but it doesn’t seem to work: Answer You can use itertools.product to handle the nested loops for you, and I think (although I’m not sure because I can’t see your data) y…
Iterate through an adjacency matrix with a list
So I have a n x n adjacency matrix, N x N NumPy array, where the i-th row and the j-th column is the distance between the i-th and j-th cities. I also have list, in a specific order in which I have to visit the cities and and add the distances together. The list items are pointing to row/column
How can I use value_counts() only for certain values?
I want to extract how many positive reviews by brand are in a dataset which includes reviews from thousands of products. I used this code and I got a table including percentaje of positive and non-positive reviews. How can I get only the percentage of positive reviews by brand? I only want the “TrueR…
ModuleNotFoundError: No module named ‘wtforms.fields.html5’
I have a flask app that uses wtforms. I have a file which does: I just wanted to rebuild my docker container and now I have this error: I have in my requirements.txt: I tried to add flask_WTF but it did not fix it. Any idea what’s going on? I thought of upgrading wtforms but it seems like I have