I'm pretty new to python, but I'm trying to transpose a time field for a set of data I'm working with in ArcMap. I changed the file locations and fields to my needs. However, when I try to run the script in the python window I get the error
Parsing error SyntaxError: invalid syntax (line 1)
It seems like this is an error with importing arcpy, but I believe ArcMap contains ArcPy. Additionally, running just import arcpy in the scripting window works fine.
Here is the Code:
# Name: TransposeFields_Ex_02.py # Description: Tranpose field names from column headers to values in one column # Requirements: None # Import system modules import arcpy from arcpy import env # set workspace arcpy.env.workspace = "H:\Users\bdf006\Desktop\GIS Review\Pittsburgh Roads\RoadsWithTime.gdb" # Set local variables inTable = "Pittsburgh_Roads_Counts" # Specify fields to transpose fieldsToTranspose = "1a;2a;3a;4a;5a;6a;7a;8a;9a;10a;11a;12p;1p;2p;3p;4p;5p;6p;7p;8p;9p;10p;11p;12a" # Set a variable to store output feature class or table outTable = "Pittsburgh_Roads_Counts_With_Timw" # Set a variable to store time field name transposedFieldName = "Transposed_Time" # Set a variable to store value field name valueFieldName = "Value" # Specify attribute fields to be included in the output attrFields = "Shape;Type" # Execute TransposeTimeFields arcpy.TransposeFields_management(inTable, fieldsToTranspose, outTable, transposedFieldName, valueFieldName, attrFields)