Appending rows since start date in Python

Is there a way to append rows since the starting date of the first value for ID:

def Net_CF(df: pd.DataFrame) -> pd.DataFrame:
new_dict = {}
ids = pd.unique(df['InvestmentSecurityIdentifier'])
quarter_years = pd.unique(df['QuarterYear'])
for Id in ids:
    new_dict[Id] = {}
    for q_year in quarter_years:
        new_dict[Id][q_year] = pd.DataFrame(columns=["AsOfDate", "Net_CF"])
for index, row in df.iterrows():
    net_cf = row["Capital_Called_Distributed"] + row["NAV"]
    new_row_df = pd.DataFrame([[net_cf, row["AsOfDate"]]], columns=["Net_CF", "AsOfDate"])
    new_dict[row['InvestmentSecurityIdentifier']][row['QuarterYear']] = new_dict[row['InvestmentSecurityIdentifier']][row['QuarterYear']].append(new_row_df)

return new_dict

Instead of adding the row row["Capital_Called_Distributed"] only for the same quarter. I would like to add all rows since the first value for ID. This means that, as time progresses, this new_dict gets longer, until the last date (then we move on to a new ID).

The data frame looks as follows:

Data Frame

Each new_dict contains all values for Capital_Called_Distributed since the first date, e.g., moving on to the 3nd quarter for ID 877, we take all the rows of the Capital_Called_Distributed column since 2018-06-13.

Thanks in advance!

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum