I have observed that when working with a dataset in pandas, it is common to apply classifiers on a data frame or series to make predictions on a subset of the data. Using
.values can make the code harder to read and debug. It also creates a copy of the data, which can be memory-intensive and slows down the computation time. If readability and interpretability are important, it may be better to avoid using
.values and find alternative solutions that work directly with Panda’s data structures. I have found one method that helps me in avoiding using the
.values function that is below:
I believe that there are many other methods available that experienced persons have coded. If you know one, I will appreciate you sharing it with me.