Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas apply

import pandas as pd

s = pd.Series([1,2,3,4,5])
  
# adding 5 to each value
new = s.apply(lambda num : num + 5)
  
# printing elements of old and new series
print(s.head().values,"
",new.head().values)
#  [1 2 3 4 5] 
#  [6 7 8 9 10]
 
PREVIOUS NEXT
Tagged: #pandas #apply
ADD COMMENT
Topic
Name
2+6 =