{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Deprecations with version 2.1.0" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import libpysal \n", "import geopandas as gpd\n", "import mapclassify as mc" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "columbus = gpd.read_file(libpysal.examples.get_path('columbus.shp'))" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:483: UserWarning: Deprecated (2.1.0): Equal_Interval is being renamed to EqualInterval. Equal_Interval will be removed on 2020-01-31.\n", " warn(self.message)\n" ] }, { "data": { "text/plain": [ " Equal Interval \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 13.921 2\n", "13.921 < x[i] <= 27.664 16\n", "27.664 < x[i] <= 41.407 14\n", "41.407 < x[i] <= 55.149 10\n", "55.149 < x[i] <= 68.892 7" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.Equal_Interval(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "qc = mc.EqualInterval(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:483: UserWarning: Deprecated (2.1.0): HeadTail_Breaks is being renamed to HeadTailBreaks. HeadTail_Breaks will be removed on 2020-01-31.\n", " warn(self.message)\n", "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:87: DeprecationWarning: Call to deprecated function (or staticmethod) headTail_breaks. (use head_tail_breaks)\n", " return headTail_breaks(values[values >= mean], cuts)\n", "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:87: DeprecationWarning: Call to deprecated function (or staticmethod) headTail_breaks. (use head_tail_breaks)\n", " return headTail_breaks(values[values >= mean], cuts)\n", "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:87: DeprecationWarning: Call to deprecated function (or staticmethod) headTail_breaks. (use head_tail_breaks)\n", " return headTail_breaks(values[values >= mean], cuts)\n", "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:87: DeprecationWarning: Call to deprecated function (or staticmethod) headTail_breaks. (use head_tail_breaks)\n", " return headTail_breaks(values[values >= mean], cuts)\n" ] }, { "data": { "text/plain": [ " HeadTailBreaks \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 35.129 25\n", "35.129 < x[i] <= 49.361 12\n", "49.361 < x[i] <= 57.542 8\n", "57.542 < x[i] <= 63.304 3\n", "63.304 < x[i] <= 68.892 1" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.HeadTail_Breaks(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:87: DeprecationWarning: Call to deprecated function (or staticmethod) headTail_breaks. (use head_tail_breaks)\n", " return headTail_breaks(values[values >= mean], cuts)\n", "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:87: DeprecationWarning: Call to deprecated function (or staticmethod) headTail_breaks. (use head_tail_breaks)\n", " return headTail_breaks(values[values >= mean], cuts)\n", "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:87: DeprecationWarning: Call to deprecated function (or staticmethod) headTail_breaks. (use head_tail_breaks)\n", " return headTail_breaks(values[values >= mean], cuts)\n", "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:87: DeprecationWarning: Call to deprecated function (or staticmethod) headTail_breaks. (use head_tail_breaks)\n", " return headTail_breaks(values[values >= mean], cuts)\n" ] }, { "data": { "text/plain": [ " HeadTailBreaks \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 35.129 25\n", "35.129 < x[i] <= 49.361 12\n", "49.361 < x[i] <= 57.542 8\n", "57.542 < x[i] <= 63.304 3\n", "63.304 < x[i] <= 68.892 1" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.HeadTailBreaks(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:483: UserWarning: Deprecated (2.1.0): Box_Plot is being renamed to BoxPlot. Box_Plot will be removed on 2020-01-31.\n", " warn(self.message)\n" ] }, { "data": { "text/plain": [ " Box Plot \n", " \n", " Lower Upper Count\n", "==========================================\n", " x[i] <= -22.757 0\n", "-22.757 < x[i] <= 20.049 13\n", " 20.049 < x[i] <= 34.001 12\n", " 34.001 < x[i] <= 48.585 12\n", " 48.585 < x[i] <= 91.391 12" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.Box_Plot(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ " Box Plot \n", " \n", " Lower Upper Count\n", "==========================================\n", " x[i] <= -22.757 0\n", "-22.757 < x[i] <= 20.049 13\n", " 20.049 < x[i] <= 34.001 12\n", " 34.001 < x[i] <= 48.585 12\n", " 48.585 < x[i] <= 91.391 12" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.BoxPlot(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:483: UserWarning: Deprecated (2.1.0): Natural_Breaks is being renamed to NaturalBreaks. Natural_Breaks will be removed on 2020-01-31.\n", " warn(self.message)\n" ] }, { "data": { "text/plain": [ " NaturalBreaks \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 0.224 2\n", " 0.224 < x[i] <= 22.541 12\n", "22.541 < x[i] <= 34.001 11\n", "34.001 < x[i] <= 48.585 12\n", "48.585 < x[i] <= 68.892 12" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.Natural_Breaks(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ " NaturalBreaks \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 0.224 2\n", " 0.224 < x[i] <= 22.541 12\n", "22.541 < x[i] <= 34.001 11\n", "34.001 < x[i] <= 48.585 12\n", "48.585 < x[i] <= 68.892 12" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.NaturalBreaks(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:483: UserWarning: Deprecated (2.1.0): Fisher_Jenks is being renamed to FisherJenks. Fisher_Jenks will be removed on 2020-01-31.\n", " warn(self.message)\n" ] }, { "data": { "text/plain": [ " FisherJenks \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 0.224 2\n", " 0.224 < x[i] <= 22.541 12\n", "22.541 < x[i] <= 34.001 11\n", "34.001 < x[i] <= 48.585 12\n", "48.585 < x[i] <= 68.892 12" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.Fisher_Jenks(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ " FisherJenks \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 0.224 2\n", " 0.224 < x[i] <= 22.541 12\n", "22.541 < x[i] <= 34.001 11\n", "34.001 < x[i] <= 48.585 12\n", "48.585 < x[i] <= 68.892 12" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.FisherJenks(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:483: UserWarning: Deprecated (2.1.0): Std_Mean is being renamed to StdMean. Std_Mean will be removed on 2020-01-31.\n", " warn(self.message)\n" ] }, { "data": { "text/plain": [ " StdMean \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 1.665 2\n", " 1.665 < x[i] <= 18.397 6\n", "18.397 < x[i] <= 51.861 30\n", "51.861 < x[i] <= 68.593 10\n", "68.593 < x[i] <= 68.892 1" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.Std_Mean(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ " StdMean \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 1.665 2\n", " 1.665 < x[i] <= 18.397 6\n", "18.397 < x[i] <= 51.861 30\n", "51.861 < x[i] <= 68.593 10\n", "68.593 < x[i] <= 68.892 1" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.StdMean(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:483: UserWarning: Deprecated (2.1.0): User_Defined is being renamed to UserDefined. User_Defined will be removed on 2020-01-31.\n", " warn(self.message)\n" ] }, { "data": { "text/plain": [ " UserDefined \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 51.862 38\n", "51.862 < x[i] <= 69.000 11" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.User_Defined(columbus.CRIME, bins=[51.862, 69.0])" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ " UserDefined \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 51.862 38\n", "51.862 < x[i] <= 69.000 11" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.UserDefined(columbus.CRIME, bins=[51.862, 69.0])" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:483: UserWarning: Deprecated (2.1.0): Jenks_Caspall is being renamed to JenksCaspall. Jenks_Caspall will be removed on 2020-01-31.\n", " warn(self.message)\n" ] }, { "data": { "text/plain": [ " JenksCaspall \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 20.049 13\n", "20.049 < x[i] <= 29.028 7\n", "29.028 < x[i] <= 36.869 7\n", "36.869 < x[i] <= 48.585 10\n", "48.585 < x[i] <= 68.892 12" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.Jenks_Caspall(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ " JenksCaspall \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 20.049 13\n", "20.049 < x[i] <= 29.028 7\n", "29.028 < x[i] <= 36.869 7\n", "36.869 < x[i] <= 48.585 10\n", "48.585 < x[i] <= 68.892 12" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.JenksCaspall(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:483: UserWarning: Deprecated (2.1.0): Jenks_Caspall_Sampled is being renamed to JenksCaspallSampled. Jenks_Caspall_Sampled will be removed on 2020-01-31.\n", " warn(self.message)\n", "/home/serge/anaconda3/envs/pysaldev/lib/python3.7/site-packages/pandas/core/computation/expressions.py:183: UserWarning: evaluating in Python space because the '*' operator is not supported by numexpr for the bool dtype, use '&' instead\n", " .format(op=op_str, alt_op=unsupported[op_str]))\n", "/home/serge/anaconda3/envs/pysaldev/lib/python3.7/site-packages/numpy/core/fromnumeric.py:56: FutureWarning: Series.nonzero() is deprecated and will be removed in a future version.Use Series.to_numpy().nonzero() instead\n", " return getattr(obj, method)(*args, **kwds)\n" ] }, { "data": { "text/plain": [ " JenksCaspallSampled \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 16.492 6\n", "16.492 < x[i] <= 41.968 27\n", "41.968 < x[i] <= 42.445 1\n", "42.445 < x[i] <= 61.299 13\n", "61.299 < x[i] <= 68.892 2" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.Jenks_Caspall_Sampled(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:483: UserWarning: Deprecated (2.1.0): Jenks_Caspall_Forced is being renamed to JenksCaspallForced. Jenks_Caspall_Forced will be removed on 2020-01-31.\n", " warn(self.message)\n" ] }, { "data": { "text/plain": [ " JenksCaspallForced \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 18.905 10\n", "18.905 < x[i] <= 29.028 10\n", "29.028 < x[i] <= 38.426 9\n", "38.426 < x[i] <= 52.794 10\n", "52.794 < x[i] <= 68.892 10" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.Jenks_Caspall_Forced(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/plain": [ " JenksCaspallForced \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 18.905 10\n", "18.905 < x[i] <= 29.028 10\n", "29.028 < x[i] <= 38.426 9\n", "38.426 < x[i] <= 52.794 10\n", "52.794 < x[i] <= 68.892 10" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.JenksCaspallForced(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/plain": [ " JenksCaspallSampled \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 18.905 10\n", "18.905 < x[i] <= 34.001 15\n", "34.001 < x[i] <= 54.522 16\n", "54.522 < x[i] <= 54.839 1\n", "54.839 < x[i] <= 68.892 7" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.JenksCaspallSampled(columbus.CRIME)" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/serge/Dropbox/p/pysal/src/subpackages/mapclassify/mapclassify/classifiers.py:483: UserWarning: Deprecated (2.1.0): Max_P_Classifier is being renamed to MaxP. Max_P_Classifier will be removed on 2020-01-31.\n", " warn(self.message)\n" ] }, { "data": { "text/plain": [ " MaxP \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 27.823 19\n", "27.823 < x[i] <= 29.028 1\n", "29.028 < x[i] <= 39.175 10\n", "39.175 < x[i] <= 50.732 8\n", "50.732 < x[i] <= 68.892 11" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.Max_P_Classifier(columbus.CRIME, k=5)" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/plain": [ " MaxP \n", " \n", "Lower Upper Count\n", "========================================\n", " x[i] <= 27.823 19\n", "27.823 < x[i] <= 29.028 1\n", "29.028 < x[i] <= 39.175 10\n", "39.175 < x[i] <= 50.732 8\n", "50.732 < x[i] <= 68.892 11" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mc.MaxP(columbus.CRIME, k=5)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }