Pandas, Python, Data Science, Machine Learning, Programming.
data type conversion: # Convert a column to categorical type df['Category'] = pd.Categorical(df['Category']) # Perform one-hot encoding df_encoded = pd.get_dummies(df, columns=['Category']) Explanation: - Converting a column to a categorical type (pd.Categorical()) optimizes memory usage for