apply
Applies to: python
apply runs a function over rows, columns, or values. It is flexible but often slower than vectorized operations.
df["x2"] = df["x"].apply(lambda x: x*x)
See also: function, pandas-dataframe
Applies to: python
apply runs a function over rows, columns, or values. It is flexible but often slower than vectorized operations.
df["x2"] = df["x"].apply(lambda x: x*x)
See also: function, pandas-dataframe