Skip To Content

Split By Attributes

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_analysis (Input_Table, Target_Workspace, Split_Fields)
ParameterExplanationData 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
Split_Fields
[Split_Fields,...]

The fields on which the input will be split into new feature classes or tables.

Field

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 Python script)

The following script demonstrates how to use the SplitByAttributes tool.

# Name: SplitByAttributes.py
# 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)

Licensing information

  • ArcGIS Desktop Basic: Yes
  • ArcGIS Desktop Standard: Yes
  • ArcGIS Desktop Advanced: Yes

Related topics