campusx-official / 100-days-of-machine-learning

1.22k stars 1.63k forks source link

Issue on day 45 while Feature Splitting #37

Open AbdullahAssi opened 9 months ago

AbdullahAssi commented 9 months ago

in the day 45 while doing groupby of 'Title and Survived' Error is occuring because of datatype.

Error can be solved by using this code.

`df['Survived'] = pd.to_numeric(df['Survived'], errors='coerce') # Convert to numeric, coerce errors to NaN

result = df.groupby('Title')['Survived'].mean().sort_values(ascending=False)

result.head()`