What is the use of .toarray()?

one_hot = enc.transform(medical_df[[‘region’]]).toarray()

why we are using .toarray() at the end

Hey @sharmarupesh271, welcome to the community.
.toarray() converts the data you got from the encoder into a numpy ndarray.

Thanks @birajde.Great content on jovian… And that for free. Keep it up guys.

1 Like

if i dont use to.array() in above code what would be the data type? why cant we use the same datatype for further operations