I have a df that looks like this: I want to create a new column named promoted from the columns master_feature, epic, and feature: value of promoted will be : master feature if adjacent master_feature column value is not null. feature if adjacent feature column value is not null ,and likewise for epic somethi…
Change certain values in a dataframe column based on conditions on several columns
Let’s take this sample dataframe : I would like to replace the “B” values in Category by “B2” where there is a C or a D in Subcategory. I tried the following but I get the error “The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()&#…
Django React Serving Together Page not found (404)
I develop an application using Django and React. I want to serving Django and React together. I create an build in react. I use it in Django. This is urls.py ; and views.py; When I run development server there is no any error but when ı want to go url directly ; http://www.x.com:8000/accounts I got page not f…
The view urlshort.views.page_redirect didn’t return an HttpResponse object. It returned None instead
I’m making a url shortener with django. I have a form that has a long_url attribute. I’m trying to get the long_url and add it to a redirect view with a HttpResponseRedirect. When I go to the link, it gives me The view urlshort.views.page_redirect didn’t return an HttpResponse object. It ret…
Python, Tkinter entry get to function (error was with function call from button)
The entry value is just simply doesn’t get passed into the function, whatever I do. Edit: I just realized, if I add a variable to the function, it gets called as soon as I run the program, and it doesn’t care about the button; but if I don’t give it a variable, it works as it should, only wh…
Saving a csv with current date and time
I am running some code and I would like to save a csv file which include the current date and time in its name. For example: I run some code now (12:24, Jan 15) and I would like to have something like Can you tell me how to print/save this information, please? Answer Here is the code according to your
Extract IBAN from text with Python
I want to extract IBAN numbers from text with Python. The challenge here is, that the IBAN itself can be written in so many ways with spaces bewteen the numbers, that I find it difficult to translate this in a usefull regex pattern. I have written a demo version which tries to match all German and Austrian IB…
Content-Security-Policy problems Google Cloud Function
I’ve build a google cloud function that takes an input and sends it to Firestore. I’ll need to call it inside a Firefox WebExtension, that I’ll use on Twitter. Not the first time I’m doing this type of project but this time I’m having issues regarding the “Content-Security-…
Reading a file without locking it in Python
I want to read a file, but without any lock on it. Can the code above lock the source file? This source file can be updated at any time with new rows (during my script running for example). I think not because it is only in reading mode (“rb”). But I found that we can use Windows API to read
Length function in Matlab to python
I am attempting to translate the following Matlab code into python d=real(ifft(fft(fw).*conj(fft(rv)))) d=[d(ld+1:length(d)) d(1:ld)]’ but the problem occurs in the following line of code: ld=length(d) My question is about the length function in matlab. How do I translate this correctly to python, to ge…