import pandas

# Load presentations of statements
pre = pandas.read_csv('data/sec/pre.txt.gz', sep='\t', index_col='adsh')

# Leave only income statements
pre = pre.query('stmt == "IS"')

# Find taxonomies containing "GAAP" (case-insensitive)
pre.loc[pre.version.str.lower().str.contains('gaap'), 'version'].drop_duplicates()

# Leave only US GAAP rows
pre = pre[pre.version.str.startswith('us-gaap/')]

# Join submissions with presentations of statements
df = sub.join(pre)

# Load numbers of the statements
num = pandas.read_csv('data/sec/num.txt.gz', sep='\t', index_col='adsh')
