You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
~\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas_datareader\moex.py in ?(self)
211 b = self.read_all_boards()
212 result = pd.DataFrame()
213 for secid in list(set(b["SECID"].tolist())):
214 part = b[b["BOARDID"] == boards[secid]]
--> 215 result = result.append(part)
216 result = result.drop_duplicates()
217 return result
~\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\core\generic.py in ?(self, name)
6295 and name not in self._accessors
6296 and self._info_axis._can_hold_identifiers_and_holds_name(name)
6297 ):
6298 return self[name]
-> 6299 return object.getattribute(self, name)
AttributeError: 'DataFrame' object has no attribute 'append'
The text was updated successfully, but these errors were encountered:
This is happening because, as of pandas 2.0, the append method (which was previously deprecated) has been removed. We need to use concat instead. For more information, see this stackoverflow question.
UPD:
It turns out that the issue has already been fixed in the main branch, so the best solution would be to install the latest development version
(or manually replace the code in your local moex.py file with that from the main branch's moex.py).
The first solution was:
Open the file ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas_datareader\moex.py
Find line 215.
It should look like this: result = result.append(part)
Replace append() with concat(). That is, replace line 215 with the following: result = pd.concat([result, pd.DataFrame(part)], ignore_index=True)
Save the changes and restart the kernel, then re-import the libraries.
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_18664\2461240623.py in ?()
1 import pandas_datareader as pdr
2 import pandas_montecarlo
3
----> 4 df = pdr.get_data_moex('SBER', start='2024-05-26')
5 df.head()
~\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas_datareader\data.py in ?(*args, **kwargs)
103 def get_data_moex(*args, **kwargs):
--> 104 return MoexReader(*args, **kwargs).read()
~\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas_datareader\moex.py in ?(self)
211 b = self.read_all_boards()
212 result = pd.DataFrame()
213 for secid in list(set(b["SECID"].tolist())):
214 part = b[b["BOARDID"] == boards[secid]]
--> 215 result = result.append(part)
216 result = result.drop_duplicates()
217 return result
~\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\core\generic.py in ?(self, name)
6295 and name not in self._accessors
6296 and self._info_axis._can_hold_identifiers_and_holds_name(name)
6297 ):
6298 return self[name]
-> 6299 return object.getattribute(self, name)
AttributeError: 'DataFrame' object has no attribute 'append'
The text was updated successfully, but these errors were encountered: