The following code:
# Replace No Data values (-1) with large number (999)
grid = grid.replace(-1, 999)
Fails with the below error:
TypeError: Value should be either a BaseGeometry or None, got 999
Replaced with the below code, which limits the change to the first 14 columns (i.e. geometry column excluded):
for col in grid.columns[:14]:
grid[col].replace(-1, 999, inplace=True)