Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Computer Column
abhipro
Hi all,
I have a column in my dataset which contains different languages. The problem is the duplicate values which can be grouped together , i.e. 'English (United States)' and 'English (Great Britain)'.
I tried to create a computed column with the following script
if(row["description"] = 'English (United States)')
{
'English';
}
else if(row["description"] = 'English (Great Britain)')
{
'English';
}
else
{
row["description"]
}
But it inserted 'English' for all the values in the new computed column. As per the script, the changes should be made only where the condition matches.. the other languages should be copied exactly as they are..
It seems that the error is in the last else statement..
any suggestions would be highly appreciated..
Regards,
Abhi
Find more posts tagged with
Comments
johnw
You are using an assignment operator. Try the following:
if(row["description"] == 'English (United States)')
{
'English';
}
else if(row["description"] == 'English (Great Britain)')
{
'English';
}
else
{
row["description"]
}
Or better yet:
if(row["description"].equals('English (United States)'))
{
'English';
}
else if(row["description"].equals('English (Great Britain)'))
{
'English';
}
else
{
row["description"]
}
Let me know if either of those don't work.
John