Created
November 20, 2019 10:01
-
-
Save icoxfog417/30e25cfeb60023c1e16bacc4678db99b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xbrl_data = [] | |
for i, row in data.iterrows(): | |
tag_name = row["element"] | |
for n in namespaces: | |
if tag_name.startswith(n): | |
tag_name = f"{n}:{tag_name.replace(n + '_', '')}" | |
break | |
tag = xbrl.find(tag_name) | |
element = tag.element | |
if element is None: | |
continue | |
item = {} | |
for k in data.columns: | |
item[k] = row[k] | |
for i in range(parent_depth): | |
parent_label = data[data["element"] == row[f"parent_{i}"]]["label"] | |
item[f"parent_{i}_name"] = "" if len(parent_label) == 0 else parent_label.tolist()[0] | |
item["value"] = element.text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment