Skip to content
Advertisement

Tag: dataframe

Spline interpolation on dataframes by row

I have the following data frame: I am trying to apply a spline interpolation on each row to get the values for 2017 and 2018 using the following code: However, I get the following error: ValueError: Index column must be numeric or datetime type when using spline method other than linear. Try setting a numeric or datetime index column before

Change pandas dataframe content in a function

I’m writing a class that does one hot encoding, but it doesn’t work as I expected. On my main code I have this: The class method is the following: Now, with print(data.columns) I can see that the method works correctly, but when train_x_categorical.head() runs I can’t see the effect of the method applyOneHotEncoding. I don’t understand why this is happening

I want to select data from different df, how can I speed it up?

I want to take the last data before the specified time from different time intervals df, my code is as follows: On my computer, the running time of get_result_df() is 204ms, how can I speed up the running speed of get_result_df()? I optimized it, and the running time was reduced to 53ms. Is there any room for improvement? Answers to

SHAP Linear model waterfall with KernelExplainer and LinearExplainer

I am working on binary classification and trying to explain my model using SHAP framework. I am using logistic regression algorithm. I would like to explain this model using both KernelExplainer and LinearExplainer. So, I tried the below code from SO here This threw an error as shown below AssertionError: Unknown type passed as data object: <class ‘shap.maskers._tabular.Independent’> How can

Advertisement