segregation.local.MultiLocalEntropy¶
-
class
segregation.local.
MultiLocalEntropy
(data, groups)[source]¶ Calculation of Local Entropy index for each unit
- Parameters
- dataa pandas DataFrame of n rows
- groupslist of strings.
The variables names in data of the groups of interest of the analysis.
Notes
Based on Eq. 6 of pg. 139 (individual unit case) of Reardon, Sean F., and David O’Sullivan. “Measures of spatial segregation.” Sociological methodology 34.1 (2004): 121-162.
Reference: [ROSullivan04].
Examples
In this example, we are going to use 2000 Census Tract Data for Sacramento MSA, CA. The groups of interest are White, Black, Asian and Hispanic population.
Firstly, we need to perform some import the modules and the respective function.
>>> import libpysal >>> import geopandas as gpd >>> from segregation.local import MultiLocalEntropy
Then, we read the data and create an auxiliary list with only the necessary columns for fitting the index.
>>> input_df = gpd.read_file(libpysal.examples.get_path("sacramentot2.shp")) >>> groups_list = ['WHITE_', 'BLACK_', 'ASIAN_','HISP_']
The value is estimated below.
>>> index = MultiLocalEntropy(input_df, groups_list) >>> index.statistics[0:10] # Values of first 10 units array([0.24765538, 0.40474253, 0.50900607, 0.21433739, 0.16148146, 0.21454691, 0.08889013, 0.08132889, 0.06782401, 0.18127186])
- Attributes
- statisticsnp.array(n)
Local Entropy values for each unit
- core_dataa pandas DataFrame
A pandas DataFrame that contains the columns used to perform the estimate.
Methods
__init__
(data, groups)Initialize self.