code: def interpolate_time_if_needed(self, iInputDS, iTime):
      if not self.has_missing_data(iInputDS[iTime]):
          return iInputDS[iTime]
  
      type1 = np.dtype(iInputDS[iTime])
      if type1.kind == "M":
          lMin = iInputDS[iTime].min()
          lDiffs = iInputDS[iTime] - lMin
          lDiffs = lDiffs.apply(lambda x: x.total_seconds())
          # print("TIME_MIN" , lMin)
          # print("TIME" , iInputDS[iTime].describe())
          # print("TIME_DIFFS" , lDiffs.describe())
          lTime = lDiffs.interpolate(
              method="linear", limit_direction="both", axis=0
          )
          lTime = lTime.apply(
              lambda x: lMin + datetime.timedelta(seconds=x)
          )
          # print("TIME2" , lTime.describe())
          lTime = lTime.astype(type1)
          return lTime
      else:
          lTime = iInputDS[iTime].interpolate(
              method="linear", limit_direction="both", axis=0
          )
          lTime = lTime.astype(type1)
          return lTime
  
file_path: atspy/atspy/TS/MissingData.py
imports: import pandas
  import numpy
  import datetime
label_desc: Use image node_id 3 for calling the cMissingDataImputer obj's underlying member method code with example usage: obj.interpolate_time_if_needed(iInputDS, iTime) and returns: iInputDS, lTime, lTime