code: def avail(df):
      
      avail = DataFrame(
          {
              "start": df.apply(lambda col: col.first_valid_index()),
              "end": df.apply(lambda col: col.last_valid_index()),
          }
      )
      return avail[["start", "end"]]
docs: Return start & end availability for each column in a DataFrame.