def get_dataframe(self, squeeze=True):
    '\n        Cast recarrays for stress periods into single\n        dataframe containing all stress periods.\n\n        Parameters\n        ----------\n        squeeze : bool\n            Reduce number of columns in dataframe to only include\n            stress periods where a variable changes.\n\n        Returns\n        -------\n        df : dataframe\n            Dataframe of shape nrow = ncells, ncol = nvar x nper. If\n            the squeeze option is chosen, nper is the number of\n            stress periods where at least one cells is different,\n            otherwise it is equal to the number of keys in MfList.data.\n\n        Notes\n        -----\n        Requires pandas.\n\n        '
    try:
        import pandas as pd
    except Exception as e:
        msg = 'MfList.get_dataframe() requires pandas'
        raise ImportError(msg)
    names = ['k', 'i', 'j']
    if ('MNW2' in self.package.name):
        names += ['wellid']
    for per in range(self._model.nper):
        if hasattr(self.data[per], 'dtype'):
            varnames = list([n for n in self.data[per].dtype.names if (n not in names)])
            break
    dfs = []
    for per in self.data.keys():
        recs = self.data[per]
        if ((recs is None) or (len(recs) == 0)):
            columns = (names + list(['{}{}'.format(c, per) for c in varnames]))
            dfi = pd.DataFrame(data=None, columns=columns)
            dfi = dfi.set_index(names)
        else:
            dfi = pd.DataFrame.from_records(recs)
            dfg = dfi.groupby(names)
            count = dfg[varnames[0]].count().rename('n')
            if (count > 1).values.any():
                print('Duplicated list entry locations aggregated for kper {}'.format(per))
                for kij in count[(count > 1)].index.values:
                    print('    (k,i,j) {}'.format(kij))
            dfi = dfg.sum()
            dfi.columns = list(['{}{}'.format(c, per) for c in varnames])
        dfs.append(dfi)
    df = pd.concat(dfs, axis=1)
    if squeeze:
        keep = []
        for var in varnames:
            diffcols = list([n for n in df.columns if (var in n)])
            diff = df[diffcols].fillna(0).diff(axis=1)
            diff['{}0'.format(var)] = 1
            changed = (diff.sum(axis=0) != 0)
            keep.append(df.loc[:, changed.index[changed]])
        df = pd.concat(keep, axis=1)
    df = df.reset_index()
    df.insert(len(names), 'node', ((df.i * self._model.ncol) + df.j))
    return df
Cast recarrays for stress periods into single
dataframe containing all stress periods.

Parameters
----------
squeeze : bool
    Reduce number of columns in dataframe to only include
    stress periods where a variable changes.

Returns
-------
df : dataframe
    Dataframe of shape nrow = ncells, ncol = nvar x nper. If
    the squeeze option is chosen, nper is the number of
    stress periods where at least one cells is different,
    otherwise it is equal to the number of keys in MfList.data.

Notes
-----
Requires pandas.
def get_dataframe(self, squeeze=True):
    '\n        Cast recarrays for stress periods into single\n        dataframe containing all stress periods.\n\n        Parameters\n        ----------\n        squeeze : bool\n            Reduce number of columns in dataframe to only include\n            stress periods where a variable changes.\n\n        Returns\n        -------\n        df : dataframe\n            Dataframe of shape nrow = ncells, ncol = nvar x nper. If\n            the squeeze option is chosen, nper is the number of\n            stress periods where at least one cells is different,\n            otherwise it is equal to the number of keys in MfList.data.\n\n        Notes\n        -----\n        Requires pandas.\n\n        '
    try:
        import pandas as pd
    except Exception as e:
        msg = 'MfList.get_dataframe() requires pandas'
        raise ImportError(msg)
    names = ['k', 'i', 'j']
    if ('MNW2' in self.package.name):
        names += ['wellid']
    for per in range(self._model.nper):
        if hasattr(self.data[per], 'dtype'):
            varnames = list([n for n in self.data[per].dtype.names if (n not in names)])
            break
    dfs = []
    for per in self.data.keys():
        recs = self.data[per]
        if ((recs is None) or (len(recs) == 0)):
            columns = (names + list(['{}{}'.format(c, per) for c in varnames]))
            dfi = pd.DataFrame(data=None, columns=columns)
            dfi = dfi.set_index(names)
        else:
            dfi = pd.DataFrame.from_records(recs)
            dfg = dfi.groupby(names)
            count = dfg[varnames[0]].count().rename('n')
            if (count > 1).values.any():
                print('Duplicated list entry locations aggregated for kper {}'.format(per))
                for kij in count[(count > 1)].index.values:
                    print('    (k,i,j) {}'.format(kij))
            dfi = dfg.sum()
            dfi.columns = list(['{}{}'.format(c, per) for c in varnames])
        dfs.append(dfi)
    df = pd.concat(dfs, axis=1)
    if squeeze:
        keep = []
        for var in varnames:
            diffcols = list([n for n in df.columns if (var in n)])
            diff = df[diffcols].fillna(0).diff(axis=1)
            diff['{}0'.format(var)] = 1
            changed = (diff.sum(axis=0) != 0)
            keep.append(df.loc[:, changed.index[changed]])
        df = pd.concat(keep, axis=1)
    df = df.reset_index()
    df.insert(len(names), 'node', ((df.i * self._model.ncol) + df.j))
    return df