467-6 instructions and answer

In excercise 467-6 the instuction says as following:

  1. Find the mean price of the cheap apps and assign it to cheap_mean .
  2. For only the cheap apps, create a column in affordable_apps called price_criterion that takes the value 1 when the app’s price is lower than cheap_mean , and 0 otherwise.
  3. As you did in the above example, create a scatter plot for the reasonable apps.
  4. Run your code without submitting it.
  5. Conclude that for reasonable apps there also isn’t any significant relationship between price and rating.
  6. Repeat instructions 1 and 2 for the reasonable apps. Assign the mean to reasonable_mean .

And this corresponds with the expected solution

cheap = affordable_apps["Price"] < 5
reasonable = affordable_apps["Price"] >= 5
cheap_mean = affordable_apps.loc[cheap, "Price"].mean()

affordable_apps.loc[cheap, "price_criterion"] = affordable_apps["Price"].apply(
   lambda price: 1 if price < cheap_mean else 0
)

affordable_apps[reasonable].plot(kind="scatter", x="Price", y="Rating")

reasonable_mean = affordable_apps.loc[reasonable, "Price"].mean()

affordable_apps.loc[reasonable,"price_criterion"] = affordable_apps["Price"].apply(
   lambda price: 1 if price < reasonable_mean else 0
)

affordable_apps[reasonable].plot(kind="scatter", x="Price", y="Rating")

However
points 1 and 2 tell to work on ‘cheap apps’,
then 3 and 5 it jumps to ‘reasonable apps’.
Point 6 instructs to repeat actions 1-2 for reasonable apps.

For me it looks like instruction shall refer to ‘cheap apps’ in points 1-5 and the first plot in solution likewise. Otherwise we have two same plots and instruction is misleading.

Hey, Wiktorski.

There is an extra plot in the solution, but the instructions are correct.

In the Learn section we started exploring the cheap apps, and we finished our work in the instructions 1. and 2.

Then, in instructions 3-6, we’re doing the same thing we did for the cheap apps, only this time for the “reasonable” apps.

I hope this helps.

2 Likes