Replace gender attribute values Male/Female to M/F in Rapidminer - rapidminer

I am using RapidMiner for data mining practice on training data. I have gender attribute with values "male" and "female" in it. I want to replace these values to M and F respectively.
what operator i can use to get this done?

The Map operator is one option.

Related

Multiple potential values for an IIF statement?

I am trying to write a report for student grades. One of the subjects has 3 teachers that swap classes a lot. I have a subreport in my report that pulls through target grades from a separate dataset. One of the parameters for the subreport is 'Teacher Initials'. As they swap students frequently, a lot of the time, the students have a new teacher to the one who set them their target grade and so it is not pulled through. Is there a way of having multiple values in an IIF statement for the parameter, such as:
IIF(Fields.SubjectName.Value = "Design & Technology"
, "ABC" OR "DEF" OR "GHI"
, Fields.TeacherInitials.Value
)
Is this possible or am I just doing some wishful thinking and need to find a way to integrate the targets into my initial SQL query?
Thanks,
Rob
I "think" you can do this using something like
IIF(Fields.SubjectName.Value = "Design & Technology"
, SPLIT("ABC,DEF,GHI", ",")
, Fields.TeacherInitials.Value
)
Your target parameter (the the sub/drilldown report) would need to be multivalue.
However, this approach seems unmaintainable as you would have to change the expressions if teachers changed.
A better way would be to not pass in the teacher at all (if that's possible) and/or have the teachers looked up in the subreport from a table or better still a view that list teachers and subjects.
If this does not help, post some sample data (as text) and the expected outcome and it will be easier to understand the problems you face.

How to remove duplicate values on google data studio

I have a dimension (a column from google sheets) called products with the following values:
product = [apple , apple_old_2019, pineapple , pineapple_old_2020, pineapple_old_2017 ...]
I need to regex then and remove the pattern old_**** and then aggregate the values by name.
In Google Sheets I would replace the values and then use the Unique formula, but in Google Data Studio there isn't such function.
I created a custom field called Product_pre with this formula:
REGEXP_EXTRACT(Product , '^(.+?)(_old_[0-9]{2}-[0-9]{4})' )
Then I created another custom field with the following formula:
CASE
WHEN Product_pre_process is null THEN Product
ELSE Product_pre_process
END
The problem is that the result has duplicated values:
product_processed = [apple , apple, pineapple , pineapple, pineapple ...]
How could I fix that?
1) Extract the First Word
The REGEXP_EXTRACT function below does the trick (extracting all the characters from the beginning of each string till the first instance of _):
REGEXP_EXTRACT(Product , "^([^_]*)")
2) Consolidation
If the chart type is a Table, then removing the rest of the dimensions and leaving just the newly created dimension will result in the metric values automatically aggregating based on the two values in the dimension (apple and pineapple).
Google Data Studio Report as well as a GIF to visualise the above:

Splitting Values in new column in rapidminer 5

In rapidminer 5 I would like to split values of a column and put the new values in a new column. I.e:
BIC|"Cognome"|"Nome"|"Via_completa"|"Civico"|"Esponente"|"CAP"|"Frazione"|"Comune"|"Provincia"
50417273|"ACCROCIA"|"ALESSANDRO"|"VIA NAPOLI"|"66"||"00100"||"MILANO"|"MI"
The "Via_completa"column is made out of the values 'VIA' and 'NAPOLI'. To normalize the address according to my data set I would like to split the values 'VIA' and 'NAPOLI' in the column "Via_completa", create a new column called 'DUG' and place value 'VIA' in the new column.
Like this:
BIC|"Cognome"|"Nome"|"DUG"|"Via_completa"|"Civico"|"Esponente"|"CAP"|"Frazione"|"Comune"|"Provincia"
50417273|"ACCROCIA"|"ALESSANDRO"|"VIA"|"NAPOLI"|"66"||"00100"||"MILANO"|"MI"
In Excel there is a 'text into columns' function. Is there an operator in Rapid miner to execute this function?
Thanks,
Friso
The Split operator is one option. You need to supply a regular expression to the split pattern parameter of this operator. For a space \s+ should suffice. This outputs new attributes with names based on the original attribute but with _1, _2, ... appended so you might need to do some renaming afterwards.

Writing The EXpression in SSRS To Display any one gender based on condition

i would like to display 'his' if the sex field is male and want to display 'her' if the sex field is female...how would i write the expression for this condition in SSRS reports
You want to use Switch() or IIf(). I would recommend Switch() because I think it's easier to expand if you later need to deal with scenarios other than just "his" or "her", and it means you don't accidentally show something if the sex is NULL or an empty string or something.
Basically Switch() takes any even number of parameters, where the first in each pair is a condition, and the second is the data to return if the condition evaluates to true. You can use this to check the contents of your sex field and return his or her;
=Switch(Fields!sex.Value = "male", "his", Fields!sex.Value = "female", "her")
You can use the IIF operator to get what you want. Set the expression as,
=IIF(IsNothing(Fields!sex.Value),"defaultvalue",IIF(Fields!sex.Value = "male","His","Her"))
You should use the IsNothing to make sure to handle the NULL value from the database.

return true or false in a mysql subselect if another field contains a string

I'm trying to return a value of true or false (or yes/no, etc.) as part of a select if a particular field in a table contains a substring.
Select the ID, name, and whether or not a person is subscribed.
A field called emailList has a comma separated list of names which should be used to check if the requester is subscribed. The result of the substring search should yield the true/false value as the result in another field.
The basic query would look like this:
SELECT
id,<...>,name
FROM
table
In the <...> area, I would want something equivalent to:
`emailList` contains #input ? "Yes" : "No"
I can't figure out how to do this to save my life. I'm guessing it can be done in other ways, but this seems like a good learning opportunity. Any suggestions?
Use IF():
SELECT
id,
IF(emailList LIKE '%string%', 'Yes', 'No') AS OnEmailList,
name
FROM
table
Just replace the word "string" with the search term you're looking for or a variable in your server-side programming language of choice.