Skip to content

Instantly share code, notes, and snippets.

@terryjbates
Created January 19, 2025 11:05
Show Gist options
  • Save terryjbates/4e3827ebbc3be0fc0e541e40bb5d9f15 to your computer and use it in GitHub Desktop.
Save terryjbates/4e3827ebbc3be0fc0e541e40bb5d9f15 to your computer and use it in GitHub Desktop.
Numeric column conversion for exported FM team data.
# Create excluded columns
EXCLUDE_COLS = """Inf
Name
Apps
Best Pos
Best Role
Best Duty
Pros
Expires
Distance
Dist/90
Cons
Position
Club
On Loan From
Based
Asking Price
Salary
Nat
2nd Nat
Home Grown Status
Height
Weight
Preferred Foot
Personality
Media Handling
Shot %
Pas %
OP-Cr %
Conv %
Hdr %
xSv %
Sv %
Transfer Value
UID""".split("\n")
EXCLUDE_COLS
# Convert all the columns, barring exclusions to numeric
for col in scouting_data.columns:
if col not in EXCLUDE_COLS:
try:
# print(f"Processing {col}")
convert_to_numeric(scouting_data, scouting_data[col])
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment