Construct an array with Nan elements

0 votes
I do not know how to construct an array with some Nan elements and other float elements. Can someone share a code for this requirement?
Jul 15, 2019 in Python by Kirti
623 views

1 answer to this question.

0 votes

Create a numpy array with nan value and float values and print all the values in the array which are not nan,

import numpy
a = numpy.array([numpy.nan, 1,2,numpy.nan,3,4,5])
print(a)
print(a[~numpy.isnan(a)])
answered Jul 15, 2019 by Yogi

Related Questions In Python

0 votes
1 answer

Is it possible to create an array with all values as zero in python?

You can use  np.zeros(4,3) This will create a 4 ...READ MORE

answered May 24, 2019 in Python by Anjali
150 views
0 votes
1 answer

Reconstruct an array by replacing every element with a[[i-1]%K] - Python

Hey varsha, Have a look at this ...READ MORE

answered Jun 14, 2019 in Python by Miya
322 views
0 votes
1 answer

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Hello @kartik, Since different users might have different ...READ MORE

answered Jun 15 in Python by Niroj
• 57,260 points
2,009 views
+4 votes
7 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,348 views
0 votes
0 answers
+4 votes
6 answers
0 votes
1 answer

Is an array a view of another?

The array has a base attribute, as ...READ MORE

answered Apr 23, 2019 in Python by SDeb
• 13,250 points
71 views
0 votes
1 answer

Python code to send an email with an attachment

Hi @Vipul, try out this code. I've ...READ MORE

answered Jun 11, 2019 in Python by Adil
7,158 views