Explained with examples

What are the average house prices in different cities of the US? What are the total sales amounts of different product groups in a store? What are the average salaries in different companies?

All these questions can be answered by using a grouping operation given that we have proper data. Most data analysis libraries and frameworks implement a function to perform such operations.

In this article, we will compare two of the most popular data analysis libraries with regards to tasks that involve grouping. The first one is Python Pandas and the other is R data table.

We will be using the Melbourne housing dataset available on Kaggle for the examples. We first import the libraries and read the dataset.

## pandas
import pandas as pd
melb = pd.read_csv("/content/melb_data.csv")

## data.table
library(data.table)
melb <- fread("datasets/melb_data.csv")

#python #data-science #r #how grouping works with python pandas vs r data table #grouping works #data table

How Grouping Works with Python Pandas vs R Data Table
1.55 GEEK