ПочатиПочніть безкоштовно

Chaining chocolates

Remember all the reasons why piping is useful? Let's see them in action!

You'll be working with the chocolates DataFrame.

chocolates contains, among others, the following columns important for this exercise:

  • cocoa_percent, containing the cocoa percentage as a string, e.g., "65.5%";
  • location, containing the country where the chocolate was manufactured;
  • bean_location, containing the country where the chocolate bean was grown;
  • rating, containing the average customer rating of the chocolate.

DataFrames, Statistics, Chain, and Plots packages have been loaded for you with the using keyword.

Ця вправа є частиною курсу

Data Manipulation in Julia

Переглянути курс

Інтерактивна практична вправа

Спробуйте виконати цю вправу, доповнивши цей зразок коду.

select(chocolates, :company, :cocoa_percentage, :rating)

# Rewrite the previous code as a macro
@chain ____ ____
	select(____, ____, ____)
end
Редагувати та запускати код