How to replace all values within a list with np.nan?
a = [1.58, 2.13, 3.98, 4.12]
and what i want is
a = [nan, nan, nan, nan]
I have tried many options like replace or list comprehension, but it didn’t work.
>Solution :
import numpy as np
a = [1,2,3,4]
a = [np.nan]*len(a)
print(a)
Output:
[nan, nan, nan, nan]