Here, I have the list test_list=[1,2,3,0,5]
I want to change the list which contains empty values, like [1,2,3, ,5]
All the way I found is to add None or np.nan or just ”.
But all those values are not working at my case, cause I just need to leave the place empty. how can I create it?
(The reason I need it is to put those values into scipy’s interpolation. If there’s any know-how or tips, I will be glad to hear that)
>Solution :
Umm.. maybe yes. I just need the list which will be printed as [1, 2, 3, ,5] in this format…
You can define a class with a repr() of the empty string:
>>> class Nothing:
... def __repr__(self):
... return ''
...
>>> l = [1, 2, 3, Nothing(), 5]
>>> l
[1, 2, 3, , 5]