Im strugling to read SDMX XML file with python from below links: https://www.newyorkfed.org/xml/fedfunds.html or direct
Ideally i would like to get fund rates into dataframe but i was trying to use pandasdmx which doesnt seem to work with this one
My Current code: f
rom urllib.request import urlopen
import xml.etree.ElementTree as ET
url = "https://websvcgatewayx2.frbny.org/autorates_fedfunds_external/services/v1_0/fedfunds/xml/retrieve?typ=RATE&f=03012016&t=04032020"
d2 = urlopen(url).read()
root ET.fromstring(d2)
for elem in root.iter():
k = elem.get('OBS_VALUE')
if k is not None:
print(k)
I would like to get something that will look like this:
FUNDRATE_OBS_POINT='1%' FUNDRATE_OBS_POINT='25%'
2020-04-02 0.03 0.05
2020-04-01 0.03 0.05
2020-04-01 0.01 0.05
I found this method to be pretty ugly, and for each "data" i need to check if its not None. Is there any better way to do that?
Try something along these lines:
Output: