I am trying to predict a car price from a given dataset. When I am trying to encode the categorical data I am getting an error. I am attaching an image with the error below. Can someone help me know what I am doing wrong ? I am new to this domain. Above this code block I imported libraries and dataset and divided it into X and y. enter image description here

  • 1
    $\begingroup$ I don't see any image attached. Perhaps just paste the error text into a code block? You can enter "Code Sample" mode by pressing Ctrl + K $\endgroup$ – zachdj May 4 at 15:36
  • $\begingroup$ Sorry, attached the file now $\endgroup$ – Bhavneet May 4 at 15:38
  • 1
    $\begingroup$ Seems X.shape has just one element. Could you print X $\endgroup$ – 10xAI May 4 at 16:45
  • $\begingroup$ I printed X, and it works fine... It has multiple features and all print correctly. $\endgroup$ – Bhavneet May 5 at 6:46
  • $\begingroup$ Initial X.shape output is (10781, 8) After the column transformation, X.shape gives the output (10781, 37) But when I try use np.array on the column transformer output, the dimension gets () zero dimension array $\endgroup$ – Bhavneet May 5 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.