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
2,793 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
1,165 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
1,425 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, 2020 in Python by Niroj
• 82,840 points
23,377 views
0 votes
0 answers

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

I couldn't figure out the problem. here my ...READ MORE

Dec 17, 2020 in Python by muammer
• 120 points
7,785 views
0 votes
2 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 7, 2019 in Python by Neha
• 330 points

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

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,125 views
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,300 points
798 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
15,193 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP