Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue running In[39] #1

Open
tirthshah7 opened this issue Feb 26, 2022 · 2 comments
Open

Issue running In[39] #1

tirthshah7 opened this issue Feb 26, 2022 · 2 comments

Comments

@tirthshah7
Copy link

I was trying this code and I am having an issue running In[39].
I am having a value error.
image
image
Did you have the same problem? if not how to solve this issue?

@patross7
Copy link

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

@patross7
Copy link

I was trying this code and I am having an issue running In[39]. I am having a value error. image image 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants