I have a data and i am making a machine learning project. So firstly in my data, there are some informations like "sex,marriage,education".
So i have to apply them "OneHotEncoder or LabelEncoder".
For LabelEncoder there is no any problem. But when i apply the OneHotEncoder, it's creating new columns as 0 and 1 as it should be.
So when i'm making the dataframe, the datas which i create with OneHotEncoder, giving me that error.
ValueError: Shape of passed values is (30000, 4), indices imply (30000, 1)
I know what's wrong, but i don't know how can i fix it. Here is the code.
datas = pd.read_csv("cc_pred.csv")
marriage = datas.iloc[:,3:4].values
marriage = ohe.fit_transform(marriage).toarray()
marriagedF = pd.DataFrame(data = marriage, index = range(30000), columns=["Marriage"])
Here is the error again.
ValueError: Shape of passed values is (30000, 4), indices imply (30000, 1)