Even though I have successfully installed sklearn via Jupyter, I cannot access its classes. What mistake did I make?

41 views Asked by At

Even though I have successfully installed sklearn via Jupyter, I cannot access its classes. What mistake did I make?

!pip install sklearn
import sklean
from sklearn.preprocessing import LabelEncoder
ImportError                               Traceback (most recent call last)
Input In [7], in <cell line: 2>()
      1 import pandas as pd
----> 2 from sklearn.preprocessing import LabelEncoder
      3 label_encoder = LabelEncoder()
      4 # Aplique o LabelEncoder à coluna categórica

ImportError: cannot import name 'LabelEncoder' from 'sklearn.preprocessing' (unknown location).
1

There are 1 answers

1
AudioBubble On

The error you're encountering is due to a typo in your code.
You wrote "import sklean" instead of "import sklearn," and that's why you can't access the classes from the sklearn.preprocessing module.