Label Encoding of the Target Variable
1234567891011121314from sklearn.preprocessing import LabelEncoder import pandas as pd # Simple categorical variable fruits = pd.Series(['apple', 'orange', 'banana', 'banana', 'apple', 'orange', 'banana']) # Create label encoder object le = LabelEncoder() # Fit and transform the categorical variable using label encoding fruits_encoded = le.fit_transform(fruits) # Print the encoded values print(fruits_encoded)
Завдання
Swipe to start coding
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 3. Розділ 4
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Suggested prompts:
Сумаризуйте цей розділ
Пояснити код у file
Пояснити, чому file не вирішує завдання
Awesome!
Completion rate improved to 3.33
Label Encoding of the Target Variable
Свайпніть щоб показати меню
1234567891011121314from sklearn.preprocessing import LabelEncoder import pandas as pd # Simple categorical variable fruits = pd.Series(['apple', 'orange', 'banana', 'banana', 'apple', 'orange', 'banana']) # Create label encoder object le = LabelEncoder() # Fit and transform the categorical variable using label encoding fruits_encoded = le.fit_transform(fruits) # Print the encoded values print(fruits_encoded)
Завдання
Swipe to start coding
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Awesome!
Completion rate improved to 3.33Секція 3. Розділ 4
single