We have different data-sets available in scikit-learn (eg., Iris data-sets). Iris data-set is a bunch data type. So how can we convert a DataFrame in to a Bunch data type?
Asked
Active
Viewed 1,697 times
0
-
1Can you explain a bit more why do you want to convert a DataFrame into a Bunch Datatype? We are usually interested in converting bunch to DataFrame, for which you can find the answer here: https://stackoverflow.com/questions/38105539/how-to-convert-a-scikit-learn-dataset-to-a-pandas-dataset – Bahman Rouhani Jan 28 '20 at 10:26
-
I was playing with MNIST data set it is easy when it is bunch type. – Fahad Vadakkumpadatah Feb 04 '20 at 14:17
1 Answers
2
So how can we convert a DataFrame in to a Bunch data type?
First, you can convert the dataframe into a dict using the pandas function to_dict().
Then, using the library Bunch, you can convert the dict into an object Bunch. This answer provides a really good example of how to do it.

Noki
- 870
- 10
- 22