Ultimate Pandas Guide: Time Series Window Functions

Ultimate Pandas Guide: Time Series Window Functions

In this post, I’ll walk through another type of the window function — one where we perform our calculation based on the position of the rows, rather than the values of a categorical column.

This approach is useful anytime we want to know information about both the individual records _and _the groups they belong to.

For example, if we have customer-level transaction data, an approach like this can provide us with information about each individual transaction, as well as the total sales during the month in which it took place:

Image for post

In this post, I’ll walk through another type of the window function — one where we perform our calculation based on the position of the rows, rather than the values of a categorical column.

A note on the data

For my examples below, I’ll work with some game-level basketball data from the NCAA ML competition on Kaggle.

If basketball is not your thing, fear not.

Here is a quick data dictionary that tells you all you need to know about the variables:

  1. DayNum: Our measure of time. It counts how many days into the season the game occurred.
  2. Season: The year the game took place.
  3. Team1/Team2: The IDs of the teams that played in the game.
  4. Efficiency: A measure of how well Team1 performed in the game.
  5. Outcome: Flag for whether or not Team1 won the game (1 is win, 0 is loss).

programming technology python machine-learning data-science

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Data Science Projects | Data Science | Machine Learning | Python

Practice your skills in Data Science with Python, by learning and then trying all these hands-on, interactive projects, that I have posted for you.

Data Science Projects | Data Science | Machine Learning | Python

Practice your skills in Data Science with Python, by learning and then trying all these hands-on, interactive projects, that I have posted for you.

Data Science Projects | Data Science | Machine Learning | Python

Practice your skills in Data Science with Python, by learning and then trying all these hands-on, interactive projects, that I have posted for you.

Data Science Projects | Data Science | Machine Learning | Python

Practice your skills in Data Science with Python, by learning and then trying all these hands-on, interactive projects, that I have posted for you.

Data Science Projects | Data Science | Machine Learning | Python

Practice your skills in Data Science with Python, by learning and then trying all these hands-on, interactive projects, that I have posted for you.