Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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