Summary
Reclassifies values in a numerical or text field into classes based on bounds defined manually or using a reclassification method.
Illustration
Usage
This tool accepts feature classes or table views as the input and modifies the input data.
The tool supports the following eight reclassification methods:
- Defined interval—Each class will span the range of the Interval Size parameter value, starting with the minimum value in the field. For example, if the interval size is 10, and the minimum value is 244, the first class will include the values between 244 and 254. This method is recommended if a particular interval size is needed, for example, when reclassifying temperature values using a 10-degree range.
- Equal interval—Each class will have the same range, and the size of the range will be defined by the Number of Classes parameter value. For example, if the number of classes is 5, and the range is 0 to 100, the first class will include the values between 0 and 20. Similar to Defined interval, this method is recommended if the intervals are meaningful and also if a specific number of classes are desired. For example, you want to reclassify temperature into exactly 5 classes of equal range.
- Geometric interval—The range of each class increases or decreases geometrically (allowing to change direction once) defined by the Number of Classes parameter. This method attempts to find natural groupings in the data while keeping the class ranges approximately equal.
- Manual interval—The upper bounds and reclassed value of each class is specified in the Reclassification Table parameter. The reclassed value can be numeric or text and will create an output field of the same type. If both text and numbers are provided for reclassed values, the output field will be text. This method can be useful when none of the class breaks in the other methods are appropriate, or you want to label the classes with text instead of integers.
- Natural breaks (Jenks)—Class breaks are created around natural groupings in the data with the Jenks Natural Breaks algorithm defined by the Number of Classes parameter. This method
groups similar values and maximizes differences between
classes. This method is useful when meaningful intervals are not
present in your data, and you want to find the optimal groupings.
For example, population count by city may have natural
groupings.
- Reference: Jenks, G., Caspall, F. C. (1971). "Error on choroplethic maps: Definition, measurement, reduction." Annals of American Geographers, 61, 217-44
- Quantile—Classes include an equal number of values in each of the specified Number of Classes parameter values. For example, if there are 50 values and the number of classes is 5, each class will have 10 records. This method is useful when you want to understand where each value falls in the ranked values. For example, you want to understand the locations in which average annual income falls in the top and bottom of 10 quantiles.
- Standard Deviation—Class ranges are created using a number of standard deviations above and below the average, specified in the Number of Standard Deviations parameter. This is useful to understand where values lie in a distribution. For example, you can reclassify rainfall by one standard deviation to identify areas with rainfall greater than two standard deviations from the mean.
- Unique Values—Each unique value in a text field becomes a class. This may be useful if you need to use categories from a text field in a tool that requires a numeric field. For example, you want to convert alphanumerical county codes to integers.
When choosing the classification method, consider the type of data and how you are going to use the reclassified values. Not all methods can be used for all applications. For example, to reclassify more than one field and use them together in analysis workflows, use a technique that is consistent between data, such as quantile, rather than one that varies, such as natural breaks (Jenks).
Checking the Reverse Values (Descending) parameter (reverse_values = "DESC" in Python) will reverse the integer classes such that the class with the lowest values is reclassified as the highest class.
The quantile reclassification method creates classes in which each class contains the same number of records. However, if the Number of Classes parameter value does not divide evenly into the number of records, the remainder will be divided into each class in ascending order.
For the manual interval method, at least one of the upper bound values specified must be greater than the minimum value in the field to reclassify. Any values in the field that are greater than the maximum specified upper bound will be reclassified as -9999.
For the defined interval method, the Interval Size parameter value must be small enough that at least three classes are created.
None of the reclassification methods use sampling schemes. It is possible to obtain the range of each class from other classification methods that use sampling, such as graduated symbology.
The tools creates fields representing the class and range of each record, which are prefixed with the Output Field Name parameter value. The class field is an ascending or descending integer field, and the range field displays the range of values for each field. If the field to reclassify is a text field, only the class field will be created. If the reclassification method is manual and no reclassed values are specified, only the range field will be created.
A reclassification table is displayed in the geoprocessing messages showing the upper bound and reclassed value of each class.
Syntax
arcpy.management.ReclassifyField(in_table, field, {method}, {classes}, {interval}, {standard_deviations}, {reclass_table}, {reverse_values}, {output_field_name})
Parameter | Explanation | Data Type |
in_table | The input table or feature class containing the field to be reclassified. | Table View; Raster Layer; Mosaic Layer |
field |
The field to be reclassified. The field must be numeric or text. | Field |
method (Optional) |
Specifies how the values contained in the field specified in the Field to Reclassify parameter.
| String |
classes (Optional) | The target number of classes in the reclassified field. The maximum number of classes is 256. | Long |
interval (Optional) | The class interval size for the reclassified field. The provided value must result in at least 3 classes and not more than 1000 classes. | Double |
standard_deviations (Optional) |
Specifies the number of standard deviations for the reclassified field. Class breaks and categories are created with equal interval ranges that are a proportion of the standard deviation from the mean.
| String |
reclass_table [reclass_table,...] (Optional) | The upper bound and reclassed value for the manual reclassification method. | Value Table |
reverse_values (Optional) | Specifies the order of the reclassified values.
| Boolean |
output_field_name (Optional) | The name or prefix of the output field. If the field to reclassify is a numerical field, two fields will be created, and this name will prefix the field names. If the field to reclassify is a text field, one new field will be created with this name. | String |
Derived Output
Name | Explanation | Data Type |
updated_table | The updated table that contains the reclassified fields. | Table View |
Code sample
The following Python window script demonstrates how to use the ReclassifyField tool.
arcpy.management.ReclassifyField("Demographics", "Population",
"EQUAL_INTERVAL", 10, None, "", None, None, "Population_EQUAL_INTERVAL")
The following stand-alone Python script demonstrates how to use the ReclassifyField tool.
# Import system modules.
import arcpy
try:
# Set the workspace and input features.
arcpy.env.workspace = r"C:\\Reclassify\\MyData.gdb"
in_table = "Demographics"
# Set the input field that will be reclassified
field = "Population"
# Set the reclassification method
method = "MANUAL"
# Set the reclassification table
reclass_table = "10000 Village;100000 Town;1000000 City"
# Set the output field name
output_field_name = "SettlementType"
# Run the Reclassify Field tool
arcpy.management.ReclassifyField(in_table, field, method, "",
None, "", reclass_Table, None, output_field_name)
except arcpy.ExecuteError:
# If an error occurred when running the tool, print the error message.
print(arcpy.GetMessages())
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes