Skip to content
Advertisement

create an array or dataframe using different variables from nested for loop in python

How do I create an array or dataframe to store seedN, clf.score(X_test, y_test),n_neighbors?

JavaScript

Advertisement

Answer

Create a temporary empty list to store the results :

JavaScript

For each fit, add a new list with the desired values :

JavaScript

Finally, create the dataframe with this temporary list :

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement