Dataframe.apply(...)
This function allows you to perform data transformation on a specified column of the dataframe
Parameters
Apply.key: string- this is the column key or label, if unsure of the labels, it can be retrived by runningDataframe.labelsApply.fn: (value: any) => void- this callback function allows to perform whatever transformation you'd like to perform on the value, from as simple asvalue + 2, to complex mathematical transformationsApply?.inplace: boolean- defaults totrue; when set tofalseassigns the transformation to a new column with the label being the column label with a suffix attachedApply?.newkey: string- when this is provided in tandem withinplace: false, the new column label will be assignednewkey
Returns
Dataframe<T>
df.apply({ key: "salary", fn: (v) => v / (40 * 4), newkey: "per_hour" });