def _yield_spatial_table(patch, div, spp_col, count_col, x_col, y_col):
<EOL>try:<EOL><INDENT>div_split_list = div.replace('<STR_LIT:;>','<STR_LIT>').split('<STR_LIT:U+002C>')<EOL><DEDENT>except AttributeError:<EOL><INDENT>div_split_list = str(div).strip("<STR_LIT>").split('<STR_LIT:U+002C>')<EOL><DEDENT>div_split = (x_col + '<STR_LIT::>' + div_split_list[<NUM_LIT:0>] + '<STR_LIT:;>' +<EOL>y_col + '<STR_LIT::>' + div_split_list[<NUM_LIT:1>])<EOL>x_starts, x_ends = _col_starts_ends(patch, x_col, div_split_list[<NUM_LIT:0>])<EOL>x_offset = (x_ends[<NUM_LIT:0>] - x_starts[<NUM_LIT:0>]) / <NUM_LIT:2><EOL>x_locs = x_starts + x_offset<EOL>y_starts, y_ends = _col_starts_ends(patch, y_col, div_split_list[<NUM_LIT:1>])<EOL>y_offset = (y_ends[<NUM_LIT:0>] - y_starts[<NUM_LIT:0>]) / <NUM_LIT:2><EOL>y_locs = y_starts + y_offset<EOL>cell_locs = _product(x_locs, y_locs)<EOL>n_spp_list = [] <EOL>n_individs_list = []<EOL>spp_set_list = []   <EOL>for cellstring, cellpatch in _yield_subpatches(patch,div_split,name='<STR_LIT>'):<EOL><INDENT>spp_set = set(np.unique(cellpatch.table[spp_col]))<EOL>spp_set_list.append(spp_set)<EOL>n_spp_list.append(len(spp_set))<EOL>n_individs_list.append(np.sum(cellpatch.table[count_col]))<EOL><DEDENT>df = pd.DataFrame({'<STR_LIT>': cell_locs, '<STR_LIT>': spp_set_list,<EOL>'<STR_LIT>': n_spp_list, '<STR_LIT>': n_individs_list})<EOL>return df<EOL>
Calculates an empirical spatial table

Yields
-------
DataFrame
    Spatial table for each division. See Notes.

Notes
-----
The spatial table is the precursor to the SAR, EAR, and grid-based
commonality metrics. Each row in the table corresponds to a cell created by
a given division. Columns are cell_loc (within the grid defined by the
division), spp_set, n_spp, and n_individs.