Skip to content Skip to sidebar Skip to footer

Saving Oversampled Dataset As Csv File In Pandas

I am new to Python and apologize in advance, if it is too simple. Cannot find anything and this question did not help. My code is # Split data y = starbucks_smote.iloc[:, -1] X = s

Solution 1:

You may create dataframe:

data_res = pd.DataFrame(X)
data_res['y'] = y

and then save data_res to CSV.

Solution based on concatenation od numpy.arrays is also possible, but np.vstack is needed to make dimensions compliant:

data_res = np.concatenate((X, np.vstack(y)), axis = 1)
data_res = pd.DataFrame(data_res)

Post a Comment for "Saving Oversampled Dataset As Csv File In Pandas"