mortada / fredapi

Python API for FRED (Federal Reserve Economic Data) and ALFRED (Archival FRED)
Apache License 2.0
902 stars 159 forks source link

Replace append with concat #66

Closed tdiffendal closed 1 year ago

tdiffendal commented 1 year ago

Hello! I love fredapi and depend on it to pull the 3000+ series related to equifax subprime credit scores. With the new edition of pandas, .append is officially deprecated in favor of .concat. I believe there are three instances of .append in the fredapi code, and would deeply appreciate if they could be edited to .concat so fredapi could continue to operate in the future.

for child in root: dates.append(self._parse(child.text))

for child in root: num_results_returned += 1 series_id = child.get('id') series_ids.append(series_id)

if max_results_needed > self.max_results_per_request: for i in range(1, max_results_needed // self.max_results_per_request + 1): offset = i * self.max_results_per_request nextdata, = self.__do_series_search(url + '&offset=' + str(offset)) data = data.append(next_data)

I am still new to the backend of python packages and this is my first issue post, so apologies if this is either too complicated or something I should be able to do myself. Thank you again and please let me know if you have any questions or if there's anything I can do!

mortada commented 1 year ago

thanks for pointing this out, indeed DataFrame.append() is deprecated https://pandas.pydata.org/pandas-docs/stable/whatsnew/v1.4.0.html#deprecated-dataframe-append-and-series-append

the first two examples you listed are actually for list.append() though, so no need to change those, only the last one needs to be updated

mortada commented 1 year ago

fixed in latest version 0.5.1