Relative Content

Tag Archive for pythonpandasnumpy

Pandas: performance optimization for recursion [duplicate]

This question already has answers here: Does pandas iterrows have performance issues? (8 answers) How can I iterate over rows in a Pandas DataFrame? (34 answers) Closed 8 mins ago. The community is reviewing whether to reopen this question as of 1 min ago. I have a code which looks like for index, row in […]

Add new rows to dataset in nested for loop

The following script works when data4 is used to create dataframe, hours_date_match_barc. It breaks when I want to use data3 and I believe it is because it is not able to add more rows to out.

How to save single Random Forest model with cross validation

I am using 10 fold cross validation, trying to predict binary labels (Y) based on the embedding inputs (X).
I want to save one of the models (perhaps the one with the highest ROC AUC). I’m not sure how to do it because the ROC AUCs are not stored and I don’t know how to grab accordingly.

Number signs issue Python

The issue with number signs. When running the same code, it sometimes returns the correct signs for the numbers, but in the next run, it might return the correct absolute values, but completely random signs for the numbers. What could be the problem?

Scalable approach instead of apply in python

I use apply to loop the rows and get the column names of feat1, feat2 or feat3 if they are equal to 1 and scored is equal to 0. The column names are then inserted into a new feature called reason.