Skip to content

Question on regex not performing as expected

I am trying to change the suffixes of companies such that they are all in a common pattern such as Limited, Limiteed all to LTD. Here is my code: I’m trying ‘ABC CORPORATN’ and it’s not converting it to CORP. I can’t see what the issue is. Any help would be great. Edit: I have tr…

Determine the element which previously had focus?

In Java a FocusEvent has a method getOppositeComponent() which is where the focus came from or went to. In PyQt5 is there any way to find what previously had focus when overriding focusInEvent? As explained in a note, I want to be able to start an edit session automatically when the table view gets focus, end…

Is there a way to define a ‘heterogeneous’ kernel design to incorporate linear operators into the regression for GPflow (or GPytorch/GPy/…)?

I’m trying to perform a GP regression with linear operators as described in for example this paper by Särkkä: https://users.aalto.fi/~ssarkka/pub/spde.pdf In this example we can see from equation (8) that I need a different kernel function for the four covariance blocks (of training and test data) in th…

getting Market cap data using Yfinance

I was trying to get market cap data of stocks using yfinance. Here is my code: By using this code I get the following error: *** IndexError: list index out of range I attach screenshots of the error and also of the DataFrame I referred to the url as specified below as to circumvent this issue. Yfinance IndexE…

Factorial function using lambda

I am trying to implement the function below into one line of lambda code. I have constructed a lambda statement, but I keep getting syntax error: Answer First of all, you can’t refer to a global name z when there is a local variable (the parameter) by the same name. Thus, we will declare a lambda statem…