# Fredapi error using get\_series method from fredapi package

**URL:** <https://forum.anaconda.com/t/fredapi-error-using-get-series-method-from-fredapi-package/51231>\
**Category:** Packages & Environments\
**Created:** [February 24, 2023, 12:06pm UTC](https://forum.anaconda.com/t/fredapi-error-using-get-series-method-from-fredapi-package/51231 "2023-02-24T12:06:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hans\_Heytens](https://avatars.discourse-cdn.com/v4/letter/h/80bc00/32.png) [@Hans\_Heytens](https://forum.anaconda.com/u/Hans_Heytens)\
**Post date:** [February 24, 2023, 12:06pm UTC](https://forum.anaconda.com/t/fredapi-error-using-get-series-method-from-fredapi-package/51231/1 "2023-02-24T12:06:45Z")

</div>

Hello, fredapi package is succesfully installed in my environment. Importing fredapi and creating the fred object using my api key works. However, when actual pulling data using get\_series I get an error. I don’t get this error using other platforms (like datacamp notebook).

```auto
import fredapi as Fred
fred=Fred(api_key='some number')
sp500=fred.get_series('SP500') #pull sp500 prices

```

this is the error I get

```auto
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_12768\3735180914.py in <module>
      1 fred = Fred(api_key='48687714d90448d876bb115d06578128')
----> 2 fred.get_series('SP500')

~\anaconda3\envs\my_models\lib\site-packages\fredapi\fred.py in get_series(self, series_id, observation_start, observation_end, **kwargs)
    133 raise ValueError('No data exists for series id: ' + series_id)
    134 data = {}
--> 135 for child in root.getchildren():
    136 val = child.get('value')
    137 if val == self.nan_char:

AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'

```

Any idea what is causing this? Thank you.

---

<div class="post-metadata">

**Author:** ![Glenn\_Jones1](https://avatars.discourse-cdn.com/v4/letter/g/00a5b5/32.png) [@Glenn\_Jones1](https://forum.anaconda.com/u/Glenn_Jones1)\
**Post date:** [February 27, 2023, 12:23pm UTC](https://forum.anaconda.com/t/fredapi-error-using-get-series-method-from-fredapi-package/51231/2 "2023-02-27T12:23:09Z")

</div>

It appears that Fred is using an old API for elementree. The getchildren method was deprecated in Python 3.2 and removed in Python 3.9: [xml.etree.ElementTree — The ElementTree XML API — Python 3.8.16 documentation](https://docs.python.org/3.8/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.getchildren)

---

<div class="post-metadata">

**Author:** ![Hans\_Heytens](https://avatars.discourse-cdn.com/v4/letter/h/80bc00/32.png) [@Hans\_Heytens](https://forum.anaconda.com/u/Hans_Heytens)\
**Post date:** [March 1, 2023, 6:25pm UTC](https://forum.anaconda.com/t/fredapi-error-using-get-series-method-from-fredapi-package/51231/3 "2023-03-01T18:25:58Z")

</div>

> [@Glenn\_Jones1](#):
>
> It appears that Fred is using an old API for elementree. The getchildren method was deprecated in Python 3.2 and removed in Python 3.9:

Thank you Glen!

So what does this mean exactly? I should use and older version of Python in my local environment if I want to use Fred on my local machine?

But my online notebook on Datacamp can use the Fred package without problems. I presume this online notebook uses the latest Python version. Yet it works.

Thanks again. Appreciate you helping me out.

---

<div class="post-metadata">

**Author:** ![Glenn\_Jones1](https://avatars.discourse-cdn.com/v4/letter/g/00a5b5/32.png) [@Glenn\_Jones1](https://forum.anaconda.com/u/Glenn_Jones1)\
**Post date:** [March 3, 2023, 9:52am UTC](https://forum.anaconda.com/t/fredapi-error-using-get-series-method-from-fredapi-package/51231/4 "2023-03-03T09:52:48Z")

</div>

You need to use a version of Python that is 3.9 or older wherever you want to use Fred.

As to your Datacamp: Did you check or are you just guesssing?

---

<div class="post-metadata">

**Author:** ![Nikhil5](https://dub1.discourse-cdn.com/anaconda/user_avatar/forum.anaconda.com/nikhil5/32/6866_2.png) [@Nikhil5](https://forum.anaconda.com/u/Nikhil5)\
**Post date:** [July 16, 2026, 7:25pm UTC](https://forum.anaconda.com/t/fredapi-error-using-get-series-method-from-fredapi-package/51231/5 "2026-07-16T19:25:19Z")

</div>

try my package fedfred:

> **[FedFred: A Modern Python Client for FRED® API](https://nikhilxsunder.github.io/fedfred/)**
>
> FedFred is a feature-rich Python package for interacting with the Federal Reserve Bank of St. Louis Economic Database (FRED®). It supports synchronous and asynchronous access to FRED data, along with DataFrame transformations, rate-limiting, local...
