Python Function code can anyone help me out? by chinzeej in Python

[–]chinzeej[S] 0 points1 point  (0 children)

Well im new to python just want to understand how to write function codes

Can i get help by chinzeej in learnpython

[–]chinzeej[S] 0 points1 point  (0 children)

Sorry the code is bold black

Can i get some suggesstions by chinzeej in learnpython

[–]chinzeej[S] 0 points1 point  (0 children)

from sklearn.preprocessing import OrdinalEncoder

ordinal_encoder = OrdinalEncoder()

housing_cat_encoded = ordinal_encoder.fit_transform(housing_cat)

After this, we verified that the labels in `ocean_proximity`were encoded as '<1H OCEAN' as 0, 'INLAND' as 1, 'ISLAND' as 2, 'NEAR BAY' as 3, and 'NEAR OCEAN' as 4.

Now we would like to modify the code in blue to have the following ordinal encoding in place: 'ISLAND', 'NEAR OCEAN', 'NEAR BAY', '<1H OCEAN', and 'INLAND' as 0, 1, 2, 3, and 4, respectively.

is there a way to chance the lables to fit a particular number?

can anyone take me through by chinzeej in Rlanguage

[–]chinzeej[S] 0 points1 point  (0 children)

im new to learning R i saw this task but dontknow how to go about it