code: def _calc_frames(stats):
      
      timings = []
      callers = []
      for key, values in iteritems(stats.stats):
          timings.append(
              pd.Series(
                  key + values[:-1],
                  index=timing_colnames,
              )
          )
          for caller_key, caller_values in iteritems(values[-1]):
              callers.append(
                  pd.Series(
                      key + caller_key + caller_values,
                      index=caller_columns,
                  )
              )
  
      timings_df = pd.DataFrame(timings)
      callers_df = pd.DataFrame(callers)
      timings_df['filename:funcname'] = \
          (timings_df['filename'] + ':' + timings_df['funcname'])
      timings_df = timings_df.groupby('filename:funcname').sum()
      return timings_df, callers_df
docs: Compute a DataFrame summary of a Stats object.