Titanic-Machine-Learning-from-Disaster
Titanic-Machine-Learning-from-Disaster copied to clipboard
Issue running In[39]
I was trying this code and I am having an issue running In[39].
I am having a value error.
Did you have the same problem? if not how to solve this issue?
You need to get rid of the commas, and it will work:
for dataset in train_test_data: dataset.loc[ dataset['Age'] <= 16, 'Age'] = 0 dataset.loc[(dataset['Age'] > 16) & (dataset['Age'] <= 26)] = 1 dataset.loc[(dataset['Age'] > 26) & (dataset['Age'] <= 36), 'Age'] = 2 dataset.loc[(dataset['Age'] > 36) & (dataset['Age'] <= 62), 'Age'] = 3 dataset.loc[ dataset['Age'] > 62, 'Age'] = 4
I was trying this code and I am having an issue running In[39]. I am having a value error.
![]()
Did you have the same problem? if not how to solve this issue?
You need to get rid of the commas, and it will work:
for dataset in train_test_data: dataset.loc[ dataset['Age'] <= 16, 'Age'] = 0 dataset.loc[(dataset['Age'] > 16) & (dataset['Age'] <= 26)] = 1 dataset.loc[(dataset['Age'] > 26) & (dataset['Age'] <= 36), 'Age'] = 2 dataset.loc[(dataset['Age'] > 36) & (dataset['Age'] <= 62), 'Age'] = 3 dataset.loc[ dataset['Age'] > 62, 'Age'] = 4