Skip to content Skip to sidebar Skip to footer

Extract Quarterly Data From Multi Quarter Periods

Public companies in the US make quarterly filings (10-Q) and yearly filings (10-K). In most cases they will file three 10Qs per year and one 10K. In most cases, the quarterly filin

Solution 1:

You could define a function to subtract the quarterly totals from the annual number, and then apply the function to each row, storing the result in a new column.

In [2]: df
Out[2]:
         Annual  Q1  Q2  Q3
Revenue      18345
Expense      17234In [3]: def calc_Q4(row):
   ...:     returnrow['Annual'] -row['Q1'] -row['Q2'] -row['Q3']

In [4]: df['Q4'] = df.apply(calc_Q4, axis =1)

In [5]: df
Out[5]:
         Annual  Q1  Q2  Q3  Q4
Revenue      183456
Expense      172348

Solution 2:

I work for Calcbench.

I wrote an API for Calcbench and have example of getting SEC data into Pandas dataframes, https://www.calcbench.com/home/api.

You would need to sign up for Calcbench to use it.

Post a Comment for "Extract Quarterly Data From Multi Quarter Periods"