log transform pandas dataframe code example
Example: log transform pandas dataframe
# Calculate natural logarithm on 'Salary' column
data['natural_log'] = np.log(data['Salary'])
data # Show the dataframe
# Calculate logarithm to base 2 on 'Salary' column
data['logarithm_base2'] = np.log2(data['Salary'])
data # Show the dataframe