What the flux?
Level: Intermediate (score: 3)
One of the benefits of accounting is being able to see the financial position of a company at a point in time by viewing financial statements. Financial statements usually present financial information for multiple years side by side, as it is very useful to then see how the company's financial health changes over time by comparing the balances from one year to the next.
Balance Sheet Example
Let's look at a sample of the assets from a comparative Balance Sheet of ABC, Inc. as of 12/31/2020 and 12/31/2019. Note this is a very simple example, with just a small number of accounts:
Line Item 12/31/20 12/31/19 ASSETS Cash $500 $300 Accounts Receivable 200 100 -------------------------- TOTAL ASSETS 700 400
The amounts under each year provides important and useful information about the company for that year, but the real rich information lies in the change in balances from one year to the next. This is referred to as the fluctuation
, or flux
for short.
Calculating the Flux
A flux
can represent the dollar amount
of the change, as well as the percentage
change. The dollar amount flux is calculated by subtracting the balance in the prior year from the current year. The percent flux is calculated by dividing the dollar flux by the prior year amount. Next, one would typically identify large fluctuations that should be explained, using a minimum dollar and % change threshold.
We're accounting on you now
Now that you understand the basics of calculating a flux and identifying the line items that are over a threshold, it's time to help us do a flux analysis. You may find pandas
is a good library to use, or if you want a real challenge, you can try using just the standard library!
Within the calculate_flux
function:
- Read in the financial statement line items from the csv file
xyz.csv
. The three columns are Account, 12/31/20, and 12/31/19. Make sure the amounts are treated as integers. - Create a Dollar Flux column that represents the 12/31/20 balance minus 12/31/19 balance.
- Create a Percentage flux column that represents the dollar flux divided by the 12/31/19 balance.
- Return a list of tuples, with each tuple representing one row from the financial statement, including the two new columns.
Within the identify_flux
function:
- Use the
calculate_flux
output as the parameter. - Using the empty list
flagged_lines
, iterate through the financial statement lines, and if both the dollar and percent flux amounts (make sure to use absolute values) are over the threshold amounts in THRESHOLDS, add the whole tuple toflagged_lines
. (Note: If the prior year balance is $0, then the % should be considered above the threshold) - Return the
flagged_lines
list, which will be a list of tuples that only includes those line items that meet the threshold criteria.
Good luck and don't forget, keep calm and do accounting in Python! PS - if you want to learn more ways to do accounting in Python, check out the Pythonic Accountant youtube channel.