Pandas_ta 'Series' object has no attribute 'append'

304 views Asked by At

print(ta.version) 0.3.14b0

data.ta.strategy(exclude=["supertrend", "qqe", "psar", "hilo"])

RemoteTraceback Traceback (most recent call last)
RemoteTraceback:
"""
Traceback (most recent call last):
File "C:\ProgramData\anaconda3\Lib\multiprocessing\pool.py", line 125, in worker
result = (True, func(*args, **kwds))
^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\multiprocessing\pool.py", line 48, in mapstar
return list(map(*args))
^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\site-packages\pandas_ta\core.py", line 467, in _mp_worker
return getattr(self, method)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\site-packages\pandas_ta\core.py", line 1225, in mcgd
result = mcgd(close=close, length=length, offset=offset, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\site-packages\pandas_ta\overlap\mcgd.py", line 24, in mcgd
mcg_ds = close[:1].append(mcg_cell[1:])
^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\site-packages\pandas\core\generic.py", line 5989, in getattr
return object.getattribute(self, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Series' object has no attribute 'append'
"""

The above exception was the direct cause of the following exception:

AttributeError Traceback (most recent call last)
Cell In[4], line 29
---> 29 data.ta.strategy(exclude=["supertrend", "qqe", "psar", "hilo"])

File C:\ProgramData\anaconda3\Lib\site-packages\pandas_ta\core.py:792, in AnalysisIndicators.strategy(self, *args, **kwargs)
789 self._last_run = get_time(self.exchange, to_string=True)
791 # Apply prefixes/suffixes and appends indicator results to the DataFrame
--> 792 [self._post_process(r, **kwargs) for r in results]
794 if verbose:
795 print(f"[i] Total indicators: {len(ta)}")

File C:\ProgramData\anaconda3\Lib\site-packages\pandas_ta\core.py:792, in (.0)
789 self._last_run = get_time(self.exchange, to_string=True)
791 # Apply prefixes/suffixes and appends indicator results to the DataFrame
--> 792 [self._post_process(r, **kwargs) for r in results]
794 if verbose:
795 print(f"[i] Total indicators: {len(ta)}")

File C:\ProgramData\anaconda3\Lib\site-packages\tqdm\std.py:1178, in tqdm.iter(self)
1175 time = self._time
1177 try:
-> 1178 for obj in iterable:
1179 yield obj
1180 # Update and possibly print the progressbar.
1181 # Note: does not call self.update(1) for speed optimisation.

File C:\ProgramData\anaconda3\Lib\multiprocessing\pool.py:423, in (.0)
415 result = IMapIterator(self)
416 self._taskqueue.put(
417 (
418 self._guarded_task_generation(result._job,
(...)
421 result._set_length
422 ))
--> 423 return (item for chunk in result for item in chunk)

File C:\ProgramData\anaconda3\Lib\multiprocessing\pool.py:873, in IMapIterator.next(self, timeout)
871 if success:
872 return value
--> 873 raise value

AttributeError: 'Series' object has no attribute 'append'

I tried installing developer mode. I tried replacing append with pd.concat from the library codes.

This is weird because my code was working yesterday. :)

1

There are 1 answers

0
Chris K On

Looks like a version incompatibility. Pandas removed Series.append() from version 2 and alas it does not look like TA has been updated to reflect this.

I use the following hack to work around this issue:

pd.Series.append = pd.Series._append

It is not pretty, but until the TA libraries are updated to match the latest version of pandas then this does the job.