📜  对数规范化 python pandas - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:56.341000             🧑  作者: Mango

代码示例1
# To transform to logarithms, you need positive values,
# so translate your range of values (-1,1] to normalized (0,1] as follows

import numpy as np
import pandas as pd

df = pd.DataFrame(np.random.uniform(-1,1,(10,1)))
df['norm'] = (1+df[0])/2 # (-1,1] -> (0,1]
df['lognorm'] = np.log(df['norm'])