Rowwise min() and max() fails for column with NaNs
问题 I am trying to take the rowwise max (and min) of two columns containing dates from datetime import date import pandas as pd import numpy as np df = pd.DataFrame({'date_a' : [date(2015, 1, 1), date(2012, 6, 1), date(2013, 1, 1), date(2016, 6, 1)], 'date_b' : [date(2012, 7, 1), date(2013, 1, 1), date(2014, 3, 1), date(2013, 4, 1)]}) df[['date_a', 'date_b']].max(axis=1) Out[46]: 0 2015-01-01 1 2013-01-01 2 2014-03-01 3 2016-06-01 as expected. However, if the dataframe contains a single NaN value