Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: Polars Data Aggregation | Efficient Data Manipulation with Polars
Large Data Handling
Seção 3. Capítulo 4
single

single

Challenge: Polars Data Aggregation

Deslize para mostrar o menu

In this challenge, you will use polars to efficiently perform data aggregation on large datasets. Specifically, you are tasked with grouping a large DataFrame by one column and computing the mean of another column for each group. This is a common operation in data analysis, especially when working with big data, as it allows you to summarize and extract insights from subsets of your data without loading everything into memory at once.

Tarefa

Deslize para começar a programar

Write a function using polars that groups a DataFrame by a specified column and computes the mean of another column for each group.

  • The function must take a pl.DataFrame, a group_col string, and a value_col string as arguments.
  • The function must return a new DataFrame containing each unique value in group_col and the mean of value_col for that group.
  • The resulting DataFrame must have a column named "mean_" followed by the value_col name, containing the computed mean values.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 3. Capítulo 4
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

some-alt