Skip to content

pandas df apply condition on multiple columns

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…

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…

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…

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…