def format_dense(base_data, non_label_cols, **kwargs):
kwargs = _set_dense_defaults_and_eval(kwargs)<EOL>indexed_data = base_data.set_index(keys=non_label_cols)<EOL>columnar_data = indexed_data.stack(dropna=False)<EOL>columnar_data = columnar_data.reset_index()<EOL>num = len(non_label_cols)<EOL>columnar_data.rename(columns={<NUM_LIT:0>: kwargs['<STR_LIT>'], '<STR_LIT>' % num:<EOL>kwargs['<STR_LIT>']}, inplace=True)<EOL>if kwargs['<STR_LIT>']:<EOL><INDENT>ind = np.isnan(columnar_data[kwargs['<STR_LIT>']])<EOL>columnar_data.loc[ind, kwargs['<STR_LIT>']] = <NUM_LIT:0><EOL>columnar_data.reset_index(inplace=True, drop=True)<EOL><DEDENT>if kwargs['<STR_LIT>']:<EOL><INDENT>columnar_data = columnar_data.dropna(how="<STR_LIT>")<EOL>columnar_data.reset_index(inplace=True, drop=True)<EOL><DEDENT>return columnar_data<EOL>
Formats dense data type to stacked data type.

Takes in a dense data type and converts into a stacked data type.

Parameters
----------
data : DataFrame
    The dense data
non_label_cols : list
    A list of columns in the data that are not label columns
label_col : str
    Name of the label column in the formatted data. Default, "label"
count_col : str
    Name of the count column in the formatted data. Default, "count"
nan_to_zero : bool
    Set all nans to zero. Default, False
drop_na : bool
    Drop all columns with nan in the dataset. Default, False

Returns
-------
: DataFrame
    A formatted DataFrame in the stacked format


Notes
-----
Example of Dense Data conversion

>>> import pandas as pd
>>> dense_data = pd.DataFrame({'row' : [1,2,1,2], 'column' : [1,1,2,2],
    'labelA': [1,0,3,4], 'labelB' : [3,2,1,4]})

>>> dense_data
       column  labelA  labelB  row
0       1       1       3       1
1       1       0       2       2
2       2       3       1       1
3       2       4       4       2

[4 rows x 4 columns]

# labelA and labelB might be species names. 'row' and 'column'
# are non-species names so pass these in as non_label_cols

>>> stacked_data = format_dense(dense_data, ['row', 'column'])
>>> stacked_data
   row  column   label  count
0    1       1  labelA      1
1    1       1  labelB      3
2    2       1  labelA      0
3    2       1  labelB      2
4    1       2  labelA      3
5    1       2  labelB      1
6    2       2  labelA      4
7    2       2  labelB      4

[8 rows x 4 columns]