code: def _get_base_dataframe(df):
      
      if isinstance(df, GroupedDataFrame):
          base_df = GroupedDataFrame(
              df.loc[:, df.plydata_groups], df.plydata_groups,
              copy=True)
      else:
          base_df = pd.DataFrame(index=df.index)
      return base_df
docs: Remove all columns other than those grouped on