Skip to main content
Solved

Name grouped feature-strings


Forum|alt.badge.img

I'm creating strings from feature with the StringConcatenator. Now I would like to group the feature-strings by an attribute with the Sampler. How can I add in front of each feature-group an additional string with the group attribute?

Best answer by takashi

Hi @nindalf, if I understood the requirement correctly, this workflow could be a solution.

[Edited]

0684Q00000ArLkwQAF.png

Source (CSV)

Feature,Attribute
1,A
10,B
2,A
9,B
3,A
8,B
4,A
7,B
5,A
6,B

Result (Text)

Group A
Feature 1 Attribute:A
Feature 2 Attribute:A
Feature 3 Attribute:A
Feature 4 Attribute:A
Feature 5 Attribute:A
Group B
Feature 6 Attribute:B
Feature 7 Attribute:B
Feature 8 Attribute:B
Feature 9 Attribute:B
Feature 10 Attribute:B
View original
Did this help you find an answer to your question?

6 replies

takashi
Influencer
  • January 23, 2018
  • Is "'Feature 1 Attribute:A" a single concatenated string?
  • What result do you need to get after sampling?

 


Forum|alt.badge.img
  • Author
  • January 23, 2018
takashi wrote:
  • Is "'Feature 1 Attribute:A" a single concatenated string?
  • What result do you need to get after sampling?

 

From each feature I generate a string (one row) which include the attribute of the feature. I would like to group these strings to send them to the text writer in the correct order. Additionally, I would like to add the grouping attribute in front of each string group as shown in the picture.

 

 


takashi
Influencer
  • January 23, 2018
Change the question. Originally (i.e. before string concatenation), what attributes did the features have?

 

 


takashi
Influencer
  • January 23, 2018
I'm guessing as below.

 

The original features have two attributes called "Feature" and "Attribute" - "Feature" can store sequential number 1, 2, 3, ..; "Attribute" can store a group name: "A" or "B".

 

The requirement is:

 

  • sort the features by group name and number
  • concatenate the attribute values to create a single string "Feature <number> Attribute:<group name>"
  • insert new features containing a string "Group <group name>" before every first feature for each group
  • finally write the strings into a text file
Am I right?

 

If I was wrong, please clarify the conditions and requirements.

Forum|alt.badge.img
  • Author
  • January 23, 2018
takashi wrote:
I'm guessing as below.

 

The original features have two attributes called "Feature" and "Attribute" - "Feature" can store sequential number 1, 2, 3, ..; "Attribute" can store a group name: "A" or "B".

 

The requirement is:

 

  • sort the features by group name and number
  • concatenate the attribute values to create a single string "Feature <number> Attribute:<group name>"
  • insert new features containing a string "Group <group name>" before every first feature for each group
  • finally write the strings into a text file
Am I right?

 

If I was wrong, please clarify the conditions and requirements.

 

This sounds right!

takashi
Influencer
  • Best Answer
  • January 23, 2018

Hi @nindalf, if I understood the requirement correctly, this workflow could be a solution.

[Edited]

0684Q00000ArLkwQAF.png

Source (CSV)

Feature,Attribute
1,A
10,B
2,A
9,B
3,A
8,B
4,A
7,B
5,A
6,B

Result (Text)

Group A
Feature 1 Attribute:A
Feature 2 Attribute:A
Feature 3 Attribute:A
Feature 4 Attribute:A
Feature 5 Attribute:A
Group B
Feature 6 Attribute:B
Feature 7 Attribute:B
Feature 8 Attribute:B
Feature 9 Attribute:B
Feature 10 Attribute:B

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings