The Kernel crashes when I use np.float64

When I define the following code, and try to "apply" it to a dataframe, it gives me the above error, and when I change dtype from float64 to float32, I don’t get any errors. What might be the issue?

def round(x):
    if x.dtype == np.float64:
        return round(x)
        return x

I am just following along a bootcamp, and this happened. I am using VS Code by the way

>Solution :

You are defining the function round and then call it within itself (recursion) without any termination criteria.

A solution might be to name your function my_round or something different from the built-in function round. Or, as @tevemadar pointed out in the comment, use np.round().

Leave a Reply