Square each value of a series

#Method 1 - passing a defined function to apply(). def square(x): return x**2 series.apply(square) #Method 2 - passing an anonymous function to apply(). series.apply(lambda x: x**2)

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.