code: def impute_timeseries_dataframe(df, dt_col, mode="last", const_num=0):
      """
      impute and return a dataframe without N/A.
      :param df: input dataframe.
      :param dt_col: name of datetime colomn.
      :param mode: imputation mode, select from "last", "const" or "linear".
             "last": impute by propagating the last non N/A number to its following N/A.
                     if there is no non N/A number ahead, 0 is filled instead.
             "const": impute by a const value input by user.
             "linear": impute by linear interpolation.
      :param const_num: only effective when mode is set to "const".
      """
      assert (
          dt_col in df.columns
      ), f"dt_col {dt_col} can not be found in df."
      assert (
          pd.isna(df[dt_col]).sum() == 0
      ), "There is N/A in datetime col"
      assert mode in [
          "last",
          "const",
          "linear",
      ], f'mode should be one of ["last", "const", "linear"], but found {mode}.'
  
      res_df = None
      if mode == "last":
          res_df = _last_impute_timeseries_dataframe(df)
      if mode == "const":
          res_df = _const_impute_timeseries_dataframe(df, const_num)
      if mode == "linear":
          res_df = _linear_impute_timeseries_dataframe(df)
  
      return res_df
  
imports: import pandas
label_desc: Use image node_id 1 for calling a global function with example usage: impute_timeseries_dataframe(df, dt_col, mode, const_num) and returns: res_df