code: def modflow_hob_to_instruction_file(hob_file):
      
  
      hob_df = pd.read_csv(hob_file,delim_whitespace=True,skiprows=1,
                           header=None,names=["simval","obsval","obsnme"])
  
      hob_df.loc[:,"obsnme"] = hob_df.obsnme.apply(str.lower)
      hob_df.loc[:,"ins_line"] = hob_df.obsnme.apply(lambda x:"l1 !{0:s}!".format(x))
      hob_df.loc[0,"ins_line"] = hob_df.loc[0,"ins_line"].replace('l1','l2')
  
      ins_file = hob_file + ".ins"
      f_ins = open(ins_file, 'w')
      f_ins.write("pif ~\n")
      f_ins.write(hob_df.loc[:,["ins_line"]].to_string(col_space=0,
                                                       columns=["ins_line"],
                                                       header=False,
                                                       index=False,
                                                       formatters=[SFMT]) + '\n')
      hob_df.loc[:,"weight"] = 1.0
      hob_df.loc[:,"obgnme"] = "obgnme"
      f_ins.close()
      return hob_df
docs: write an instruction file for a modflow head observation file
  
      Parameters
      ----------
      hob_file : str
          modflow hob file
  
      Returns
      -------
      df : pandas.DataFrame
          pandas DataFrame with control file observation information