Label | Explanation | Data Type |
Input Table | The input feature class or table containing data value fields that will be transposed. | Table View |
Fields To Transpose | The fields containing data values in the input table that will be transposed. Depending on your requirements, you can select multiple fields to be transposed. The value specified here defines what the field name will be in the output. When no value is specified, the field name will be used. For example, if the field names to be transposed are Pop1991 and Pop1992, the values for these fields in the output will be the same (Pop1991 and Pop1992) by default. However, you can provide other values, such as 1991 and 1992, instead. | Value Table |
Output Table | The output feature class or table. The output will contain a transposed field, a value field, and any number of specified attribute fields that need to be inherited from the input table. By default, the value is a table. The output will be a feature class when the Input Table parameter value is a feature class and the Shape field is specified in the Attribute Fields parameter. | Table |
Transposed Field | The name of the field that will be created to store field names of the transposed fields. Any valid field name can be used. | String |
Value Field | The name of the field that will be created to store the corresponding values of the transposed fields. Any valid field name can be used, as long as it does not conflict with existing field names from the input table or feature class. | String |
Attribute Fields (Optional) | The additional attribute fields from the input table that will be included in the output table. To output a feature class, include the Shape field. | Field |
Summary
Switches data stored in fields or columns to rows in a new table or feature class.
This tool is useful when a table or feature class stores values in field names (such as Field1, Field2, Field3) that you want to rotate so they're arranged in rows. It lets you switch the field names and the corresponding data values in the fields to rows.
Illustration

Usage
By default, the output is a table. When the input is a feature class and the output should be a feature class, add the Shape field to the Attribute Fields parameter.
The output Transposed Field and Value Field field types will be text.
Parameters
arcpy.management.TransposeFields(in_table, in_field, out_table, in_transposed_field_name, in_value_field_name, {attribute_fields})
Name | Explanation | Data Type |
in_table | The input feature class or table containing data value fields that will be transposed. | Table View |
in_field [[field, {value}],...] | The fields containing data values in the input table that will be transposed. Depending on your requirements, you can select multiple fields to be transposed. The value specified here defines what the field name will be in the output. When no value is specified, the field name will be used. For example, if the field names to be transposed are Pop1991 and Pop1992, the values for these fields in the output will be the same (Pop1991 and Pop1992) by default. However, you can provide other values, such as 1991 and 1992, instead. | Value Table |
out_table | The output feature class or table. The output will contain a transposed field, a value field, and any number of specified attribute fields that need to be inherited from the input table. By default, the value is a table. The output will be a feature class when the in_table parameter value is a feature class and the Shape field is specified in the attribute_fields parameter. | Table |
in_transposed_field_name | The name of the field that will be created to store field names of the transposed fields. Any valid field name can be used. | String |
in_value_field_name | The name of the field that will be created to store the corresponding values of the transposed fields. Any valid field name can be used, as long as it does not conflict with existing field names from the input table or feature class. | String |
attribute_fields [attribute_fields,...] (Optional) | The additional attribute fields from the input table that will be included in the output table. To output a feature class, include the Shape field. | Field |
Code sample
The following Python window script demonstrates how to use the TransposeFields function in immediate mode.
import arcpy
arcpy.management.TransposeFields("C:/Data/TemporalData.gdb/Input", "Field1 newField1;Field2 newField2;Field3 newField3",
"C:/Data/TemporalData.gdb/Output_Time", "Transposed_Field", "Value", "Shape;Type")
The following stand-alone script demonstrates how to use the TransposeFields function.
# Name: TransposeFields_Ex_02.py
# Description: Transpose field names from column headers to values in one column
# Requirements: None
# Import system modules
import arcpy
# set workspace
arcpy.env.workspace = "C:/Data/TemporalData.gdb"
# Set local variables
inTable = "Input"
# Specify fields to transpose
fieldsToTranspose = "Field1 newField1;Field2 newField2;Field3 newField3"
# Set a variable to store output feature class or table
outTable = "Output_Time"
# Set a variable to store time field name
transposedFieldName = "Transposed_Field"
# Set a variable to store value field name
valueFieldName = "Value"
# Specify attribute fields to be included in the output
attrFields = "Shape;Type"
# Run TransposeTimeFields
arcpy.management.TransposeFields(inTable, fieldsToTranspose, outTable, transposedFieldName, valueFieldName, attrFields)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes