Balances that keep rising

MediumCapital Onesort_valuesgroupby diffall· 20 XP

A balance that grows every month can be an early sign that a customer is struggling. The risk team wants a list of those cards.

From statements.csv, look only at cards with statements for all 6 months. Store a sorted list of the card_ids whose balance went up from each month to the next (every one of the 5 changes is above 0).

Expected answer

Store your answer in result.

Hints, the later steps and the answer come with Pro.

import pandas as pd

statements = pd.read_csv("statements.csv")
result = ...