I am trying to read an XML file and access one specific attribute, in this case the DonorAdvisedFundInd attribute, and use it to create a dataframe in Pandas. So far I've tried the following code:
import xml.etree.ElementTree as et
import requests
xml_data = requests.get("https://s3.amazonaws.com/irs-form-990/201903199349320465_public.xml").content
xtree = et.parse(xml_data)
xroot = xtree.getroot()
df_cols = ["DAF"]
df_rows = []
for node in xroot:
is_DAF = node.attrib.get("DonorAdvisedFundInd")
df_rows.append({"DAF":is_DAF})
out_df = pd.DataFrame(df_rows, columns=df_cols)
out_df
but I'm getting this error message: Errno 36: file name too long
I appreciate any feedback and alternative suggestions anybody can provide. Thank you!