I am working on a homework assignment for my coding class, and I am having issues with the last part of the assignment. My job is to create new three shapefiles based on players' positions in a target country. The target country is Sweden, and the positions that we are creating the individual shapefiles from are:
- Left-Wing (LW)
- Right Wing (RW)
- Center (C)
The two fields are the weight and height field, and the weight field is in pounds, and the height field is in inches, and the height field is given in the text in the original shapefile (nhlrosters. hp). The new shapefiles would have the height and weight field, but the height needs to be in cm and kg.
The data for this lesson is located at: https://www.e-education.psu.edu/geog485/node/276
How can I manipulate the string for the height field? Below is the code for the weight field as an example.
import arcpy fc = r"\\C\\Data": oldField = "weight" newField = "weight_kg" arcpy.AddField_management(fc, newField, "FLOAT") with arcpy.da.UpdateCursor(fc, (oldField, newField)) as weightCursor: for weightRow in weightCursor: old_Weight = weightCursor new_Weight = old_Weight * 0.453592 weightRow = new_Weight weightCursor.updateRow(weightRow)
For the height column. The height are in feet/inches (example: 6'2")