months = tx_retention.columns[2:] retention_array = [] for i in range(len(months)-1): retention_data = {} selected_month = months[i+1] prev_month = months[i] retention_data['InvoiceYearMonth'] = int(selected_month) retention_data['TotalUserCount'] = tx_retention[selected_month].sum() retention_data['RetainedUserCount'] = tx_retention[(tx_retention[selected_month]>0) & (tx_retention[prev_month]>0)][selected_month].sum() retention_array.append(retention_data)
TypeError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_9372/2970800792.py in <module> ----> 1 for i in range(len(months)-1): 2 retention_data = {} 3 selected_month = months[i+1] 4 prev_month = months[i] 5 retention_data['InvoiceYearMonth'] = astype(selected_month) TypeError: 'int' object is not callable
months
months = tx_retention.columns[2:]
retention_data['InvoiceYearMonth'] = astype(selected_month)
astype
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)