Transpose Time Fields (Data Management)

Summary

Shifts fields from columns to rows in a table or feature class that have time as the field names. This tool is useful when your table or feature class stores time in field names (such as Pop1980, Pop1990, Pop2000, and so on), and you want to create time stamps for the feature class or table so that it can be animated through time.

Legacy:

This is a deprecated tool. This functionality has been replaced with the Transpose Fields tool that now transposes any fields from columns to rows.

Usage

  • If you want the output to be a table, you need to specify the input as a table.

  • The output must be a geodatabase feature class. A shapefile is not a supported format for the output feature class.

  • ObjectID (or OID, FID, and so on) and Shape fields should not be set as attribute fields.

Parameters

LabelExplanationData Type
Input Feature Class or Table

The input feature class or table for which time stamps will be created.

Table View
Fields to Transpose

The columns from the input table and the corresponding time values.

Multiple strings can be entered, depending on how many fields you are transposing. Each string should be formatted as "Field_Name Time" (without the quotation marks). Each is a pair of substrings separated by a space. For example, the following string is a valid input: "POP1980 1980". In this example, POP1980 is the field name of a field containing population values for 1980. 1980 is the string that will be substituted for POP1980 and populated in the time field of the output table or feature class.

String
Output Feature Class or Table

The output feature class or table. The output table can be specified as a .dbf table, an info table, or a geodatabase table. The output feature class can only be stored in a geodatabase (shapefile is not available as a format for the output). The output feature class or table will contain a time field, a value field, and any number of attribute fields specified that need to be inherited from the input table.

Table
Time Field Name

The name of the time field that will be created to store time values. The default name is "Time". Any valid field name can be used.

String
Value Field Name

The name of the value field that will be created to store the values from the input table. The default name is "Value". Any valid field name can be set, as long as it does not conflict with existing field names from the input table or feature class.

String
Attribute Fields
(Optional)

Attribute fields from the input table to be included in the output table.

Field

arcpy.management.TransposeTimeFields(Input_Feature_Class_or_Table, Fields_to_Transpose, Output_Feature_Class_or_Table, Time_Field_Name, Value_Field_Name, {Attribute_Fields})
NameExplanationData Type
Input_Feature_Class_or_Table

The input feature class or table for which time stamps will be created.

Table View
Fields_to_Transpose
[Fields_to_Transpose;Fields_to_Transpose...,...]

The columns from the input table and the corresponding time values.

Multiple strings can be entered, depending on how many fields you are transposing. Each string should be formatted as "Field_Name Time" (without the quotation marks). Each is a pair of substrings separated by a space. For example, the following string is a valid input: "POP1980 1980". In this example, POP1980 is the field name of a field containing population values for 1980. 1980 is the string that will be substituted for POP1980 and populated in the time field of the output table or feature class.

String
Output_Feature_Class_or_Table

The output feature class or table. The output table can be specified as a .dbf table, an info table, or a geodatabase table. The output feature class can only be stored in a geodatabase (shapefile is not available as a format for the output). The output feature class or table will contain a time field, a value field, and any number of attribute fields specified that need to be inherited from the input table.

Table
Time_Field_Name

The name of the time field that will be created to store time values. The default name is "Time". Any valid field name can be used.

String
Value_Field_Name

The name of the value field that will be created to store the values from the input table. The default name is "Value". Any valid field name can be set, as long as it does not conflict with existing field names from the input table or feature class.

String
Attribute_Fields
[Attribute_Fields;Attribute_Fields...,...]
(Optional)

Attribute fields from the input table to be included in the output table.

Field

Code sample

TransposeTimeFields (Python window)

The following Python window script demonstrates how to use the TransposeTimeFields tool in immediate mode.

import arcpy
arcpy.TransposeTimeFields_management("c:/data/state_pop", "'Y1980 1980';'Y1981 1981';'Y1982 1982'",
                                     "c:/data/state_output", "Time", "Value", "STATE_NAME;AVG_ANUAL_")
TransposeTimeFields (stand-alone script)

The following stand-alone script demonstrates how to use the TransposeTimeFields tool.

# Name: TransposeTimeFields_Ex_02.py
# Description: Tranpose time field names from column headers to time values in one column
# Requirements: None

# Import system modules
import arcpy
from arcpy import env

# set workspace
arcpy.env.workspace = "c:/data"

# Set local variables
inTable = "state_pop"
# Specify fields to transpose
fieldsToTranspose = "'Y1980 1980';'Y1981 1981';'Y1982 1982'"
# Set a variable to store output feature class or table
outTable = "state_output"
# Set a variable to store time field name
timeFieldName = "Time"
# Set a variable to store value field name
valueFieldName = "Value"
# Specify attribute fields to be included in the output
attrFields = "STATE_NAME;AVG_ANUAL_"

# Execute TransposeTimeFields
arcpy.TransposeTimeFields_management(inTable, fieldsToTranspose, outTable, timeFieldName, valueFieldName, attrFields)

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes