-1

[ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.09034446 0.16660596 0.20366712 0.21721049 0.22288556 0.2647726 0.30133098 0.35875865 0.67048766 0.83591387 0.84130192 1.00343632 1.08201832 1.32280598 3.71048433 4.92399325 5.7334934 5.78915343 5.79743345 11.87101934 nan nan nan nan nan] In this list, I want to remove nan values and keep only the floating-point values.

0

1 Answer 1

1

if your nan values are np.nan use this

l = [x for x in yourlist if ~np.isnan(x)]

if they are just nans use this

cleanedList = [x for x in yourlist if str(x) != 'nan']
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.