python how can I check a variable for a real number?

Is there a built in function to test if x is a number? Something that can replace this code:

if x is not None and not np.isnan(x):

Source: python

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.