...

/

Puzzle 1: Rectified

Puzzle 1: Rectified

Let's exercise our minds by solving a pandas series puzzle.

Guess the output

Try to guess the output of the code below:

Press + to interact
import pandas as pd
def relu(n):
if n < 0:
return 0
return n
arr = pd.Series([-1, 0, 1])
print(relu(arr))

Quiz

Q

What is the output of code above?

A)

0 0 1

B)

-1 0 1

C)

ValueError

D)

TypeError

Access this course and 1200+ top-rated courses and projects.