Summary
Splits an input dataset by unique attributes.
Usage
The Input Table can be a feature class or table.
A feature class or table will be created for every unique combination of attributes from the Split Fields parameter.
Syntax
SplitByAttributes(Input_Table, Target_Workspace, Split_Fields)
Parameter | Explanation | Data Type |
Input_Table | The input feature class or table whose data will be split into the target workspace. | Table View |
Target_Workspace | The existing workspace where the output feature classes or tables are written. | Workspace; Feature Dataset |
Split_Fields [Split_Fields,...] | The fields on which the input will be split into new feature classes or tables. | Field |
Derived Output
Name | Explanation | Data Type |
Target_Workspace2 | The workspace containing the features classes or tables created by splitting the input. | Workspace; Feature Dataset |
Code sample
SplitByAttributes example 1 (Python window)
The following Python window script demonstrates how to use the SplitByAttributes tool in immediate mode.
import arcpy
arcpy.env.workspace = 'c:/data/base.gdb'
arcpy.SplitByAttributes_analysis('ecology', arcpy.env.scratchGDB, ['REGION', 'ECO_CODE'])
SplitByAttributes example 2 (stand-alone script)
The following script demonstrates how to use the SplitByAttributes tool.
# Description: Use the SplitByAttributes tool to split a feature class by unique values.
# Import required modules
import arcpy
# Set local variables
in_feature_class = 'c:/data/base.gdb/ecology'
target_workspace = 'c:/data/output.gdb'
fields = ['REGION', 'ECO_CODE']
arcpy.SplitByAttributes_analysis(in_feature_class, target_workspace, fields)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes