#NEWLINE# def __pysal_choro( values , scheme , k = 5 ) : #NEWLINE# #INDENT# " Wrapper for choropleth schemes from PySAL for use with plot_dataframe\n\n        Parameters\n        ----------\n\n        values\n            Series to be plotted\n\n        scheme\n            pysal.esda.mapclassify classificatin scheme\n            ['Equal_interval'|'Quantiles'|'Fisher_Jenks']\n\n        k\n            number of classes (2 <= k <=9)\n\n        Returns\n        -------\n\n        binning\n            Binning objects that holds the Series with values replaced with\n            class identifier and the bins.\n    " #NEWLINE# try : #NEWLINE# #INDENT# from pysal.esda.mapclassify import Quantiles , Equal_Interval , Fisher_Jenks #NEWLINE# schemes = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# schemes [ 'equal_interval' ] = Equal_Interval #NEWLINE# schemes [ 'quantiles' ] = Quantiles #NEWLINE# schemes [ 'fisher_jenks' ] = Fisher_Jenks #NEWLINE# s0 = scheme #NEWLINE# scheme = scheme . lower ( ) #NEWLINE# if ( scheme not in schemes ) : #NEWLINE# #INDENT# scheme = 'quantiles' #NEWLINE# warnings . warn ( 'Unrecognized scheme "{0}". Using "Quantiles" instead' . format ( s0 ) , UserWarning , stacklevel = 3 ) #NEWLINE# #UNINDENT# if ( ( k < 2 ) or ( k > 9 ) ) : #NEWLINE# #INDENT# warnings . warn ( 'Invalid k: {0} (2 <= k <= 9), setting k=5 (default)' . format ( k ) , UserWarning , stacklevel = 3 ) #NEWLINE# k = 5 #NEWLINE# #UNINDENT# binning = schemes [ scheme ] ( values , k ) #NEWLINE# return binning #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# raise ImportError ( "PySAL is required to use the 'scheme' keyword" )