how to convert generated data into pandas dataframe

Tags: , , , ,

from sklearn.datasets import make_classification
         df = make_classification(n_samples=10000, n_features=9, n_classes=1, random_state = 18,
                                     class_sep=2, n_informative=4)

after creating the data. it is tuple and after converting tuple into pandas dataframe

  df = pd.DataFrame(data, columns=["1","2","3","4","5","6","7","8","9"])

so i got 9 features (columns) but when i try to insert 9 cols it says.

ValueError: Shape of passed values is (2, 1), indices imply (2, 9)

Basically i wanna generate data and convert it into pandas dataframe but could not get to it. error is:


The first entry of the tuple contains the feature data and the the second entry contains the class labels. So if you want to make a pd.dataframe of the feature data you should use pd.DataFrame(df[0], columns=["1","2","3","4","5","6","7","8","9"]).

Source: stackoverflow