WarrierRajeev / UFC-Predictions

A web app to predict UFC fights
https://ufc-predictions.rajeevwarrier.com
116 stars 49 forks source link

Error in preprocessing notebook #25

Open nprime496 opened 2 years ago

nprime496 commented 2 years ago

Firstly, thank you for your incredible project.

When I use data from kaggle and run this cell from preprocessing notebook :

pct_columns = ['Str_Acc','Str_Def', 'TD_Acc', 'TD_Def']

def pct_to_frac(X):
    if X != np.NaN:
        return float(X.replace('%', ''))/100
    else:
        return 0

for column in pct_columns:
    fighter_details[column] = fighter_details[column].apply(pct_to_frac)

I get this error:

KeyError: 'Str_Acc'

The above exception was the direct cause of the following exception:

KeyError                                  Traceback (most recent call last)
[/usr/local/lib/python3.7/dist-packages/pandas/core/indexes/base.py](https://localhost:8080/#) in get_loc(self, key, method, tolerance)
   3361                 return self._engine.get_loc(casted_key)
   3362             except KeyError as err:
-> 3363                 raise KeyError(key) from err
   3364 
   3365         if is_scalar(key) and isna(key) and not self.hasnans:

KeyError: 'Str_Acc'

It looks like raw_fighter_details.csv have some missing columns, can you provide feedback ?