>>> import pandas as pd
>>> import numpy as np
>>> fruits = ['peaches', 'oranges', 'cherries', 'pears']
>>> S = pd.Series([20, 33, 52, 10], index=fruits)
>>> S.apply(np.sin)
peaches 0.912945
oranges 0.999912
cherries 0.986628
pears -0.544021
dtype: float64
Wir erhöhen die Anzahl der Werte um 10, die kleiner als 50 sind:
>>> S.apply(lambda x: x if x > 50 else x+10 )
peaches 30
oranges 43
cherries 52
pears 20
dtype: int64