Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
binning="HeadTailBreaks",
gini_simpson=False,
inverse=False,
categorical=False,
categories=None,
verbose=True,
**classification_kwds
):
if not categorical:
try:
import mapclassify.classifiers as classifiers
except ImportError:
raise ImportError("The 'mapclassify' package is required")
schemes = {}
for classifier in classifiers.CLASSIFIERS:
schemes[classifier.lower()] = getattr(classifiers, classifier)
binning = binning.lower()
if binning not in schemes:
raise ValueError(
"Invalid binning. Binning must be in the"
" set: %r" % schemes.keys()
)
self.gdf = gdf
self.sw = spatial_weights
self.id = gdf[unique_id]
self.binning = binning
self.gini_simpson = gini_simpson
self.inverse = inverse
self.categorical = categorical
self.categories = categories