quantlab.dataset.massive.ten_k.section_changes#

quantlab.dataset.massive.ten_k.section_changes(keys, counts)[source]#

Compare each section with the filer’s previous annual report of it.

Parameters:
keyspl.DataFrame

One row per record: cik, section, period_end, filing_date and words; row i is row i of counts.

countsscipy.sparse.csr_matrix

The records’ hashed word counts.

Returns:
pl.DataFrame

One row per report (the first filed of a filer, section and period): cik, section, period_end, filing_date, similarity, jaccard and length_change, NaN without a previous report or with a section under MIN_WORDS words.

Examples

>>> from datetime import date
>>> keys = pl.DataFrame({"cik": [1, 1], "section": ["business"] * 2,
...     "period_end": [date(2022, 12, 31), date(2023, 12, 31)],
...     "filing_date": [date(2023, 2, 1), date(2024, 2, 1)], "words": [200.0, 200.0]})
>>> out = section_changes(keys, sp.csr_matrix(np.array([[100.0, 100.0], [100.0, 100.0]])))
>>> out.get_column("similarity").to_list()
[nan, 1.0]