Weekly_return is list
Requirements must use lambda and map
The code below
The import numpy as np
Weekly_return=list (weekly_return)
Weekly_return_without_NaN=list (map (lambda x: weekly_return. Remove (x) if True in np. The isnan (x) the else x, weekly_return [:]))
The following mistakes
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
TypeError Traceback (the most recent call last)
12 the from scipy. Stats import normaltest
13 weekly_return=list (weekly_return)
- & gt; 14 weekly_return_without_NaN=list (map (lambda x: weekly_return. Remove (x) if True in np. The isnan (x) the else x, weekly_return [:]))
15
16 print (" ttt1 ")
12 the from scipy. Stats import normaltest
13 weekly_return=list (weekly_return)
- & gt; 14 weekly_return_without_NaN=list (map (lambda x: weekly_return. Remove (x) if True in np. The isnan (x) the else x, weekly_return [:]))
15
16 print (" ttt1 ")
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types "according to the casting rule 'safe'