code: def mode(series):
      
      if series.notnull().sum() == 0:
          return np.nan
      else:
          return series.value_counts().idxmax()
docs: pandas mode is "empty if nothing has 2+ occurrences."
      this method always returns something:
          nan if the series is empty/nan), breaking ties arbitrarily