Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
find max value of a list with numpy nan
import numpy as np

print max([np.nan, 1, 2, 3, 4])
print max([1, 2, 3, 4, np.nan])
print max([1, 2, 3, np.nan, 4])

the first will print nan as list's max value

the second will print 4 as list's max value

the third will print 4 as list's max value

Is there a solution for this problem? Make all math function just ignore nan?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Use np.nanmax() to ignore any NaNs:

In [57]: np.nanmax([np.nan, 1, 2, 3, 4])
Out[57]: 4.0
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!