Options

[SOLVED] Beginner | Group by generated Attribute

PeterParkerPeterParker Member Posts: 3 Contributor I
edited November 2018 in Help
Hi Guys,

I think its an really simple solution, but I dont get it.

This is my process:
image


1. Generate Sales Data
2. Joining City names with store ids
3. Generate Attributes:
 a) total_price = amount*single_price
 b) year = date_get(date,DATE_UNIT_YEAR)
4. Select the attributes I need.
Result:
image

Now I would like the to plot the data and group by different attributes to sum the total_price.
For city and category it works greate:
image

But if I group by year, i don´t geht any bars.

Where´s the problem?

Thanks and regards,
Peter

Answers

  • Options
    swissrussswissruss RapidMiner Certified Expert, Member Posts: 11 Contributor II
    Hi Peter,

    I think the problem is that date_get() is returning a real value, which the bar plotter isn't happy about. Try converting it to a polynominal with the Numerical to Polynominal operator.

    Regards,

    Russ
  • Options
    PeterParkerPeterParker Member Posts: 3 Contributor I
    First of all, thank you for your reply.
    Unfortunately thats not the solution. I can´t even select my year attribute to transform it with the "Numerical to Polynominal" operator.  :(

  • Options
    swissrussswissruss RapidMiner Certified Expert, Member Posts: 11 Contributor II
    Hi Peter,

    I see what you mean - the problem is that the Generate Attributes Operator isn't setting the metadata for your year field to real or integer, but is "unknown" (give or take a spelling mistake in the UI!). This means it doesn't appear in the dropdown list for the Numerical to Polynominal Operator. If you type "year" into the attribute name field in the N2P Operator then it will work. As a bonus tip, if you sort by date prior to generating the new attribute you will find that the years are displayed in the correct order on the bar chart.

    Regards,

    Russ
  • Options
    PeterParkerPeterParker Member Posts: 3 Contributor I
    Thanks you swissruss.  ;)
    It works!
  • Options
    swissrussswissruss RapidMiner Certified Expert, Member Posts: 11 Contributor II
    Glad it worked! Don't forget to add "[SOLVED]" to the subject so it's easy to see what's still open - helps people looking for answers and those trying to help!

    Cheers,

    Russ
Sign In or Register to comment.