Skip to content

Glossary: pandas Beyond the Basics

diff

Also written: .diff()

Subtracts the previous row's value from each value. After `groupby` it subtracts within each group only, such as the gap between a customer's orders.

Where the book teaches it

Related terms

shiftpct_change