RuchiTanmay / nselib

nse data library
Apache License 2.0
50 stars 32 forks source link

bhav_copy_equities not working #13

Closed Wambyat closed 1 month ago

Wambyat commented 11 months ago

I'm trying to get bhav copy and this is the error I'm getting.

data = capital_market.bhav_copy_equities("20-08-2023")

This is giving me this error:

Traceback (most recent call last):
  File "c:\nse.py", line 24, in <module>
    data = capital_market.bhav_copy_equities("20-08-2023")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\nselib\capital_market\capital_market_data.py", line 432, in bhav_copy_equities
    bhav_df = bhav_df[['SYMBOL', 'SERIES', 'OPEN', 'HIGH', 'LOW', 'CLOSE', 'LAST', 'PREVCLOSE', 'TOTTRDQTY',
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\pandas\core\frame.py", line 3767, in __getitem__
    indexer = self.columns._get_indexer_strict(key, "columns")[1]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\pandas\core\indexes\base.py", line 5876, in _get_indexer_strict
    self._raise_if_missing(keyarr, indexer, axis_name)
  File "C:\Python311\Lib\site-packages\pandas\core\indexes\base.py", line 5935, in _raise_if_missing
    raise KeyError(f"None of [{key}] are in the [{axis_name}]")
KeyError: "None of [Index(['SYMBOL', 'SERIES', 'OPEN', 'HIGH', 'LOW', 'CLOSE', 'LAST', 'PREVCLOSE',\n       'TOTTRDQTY', 'TOTTRDVAL', 'TIMESTAMP', 'TOTALTRADES'],\n      dtype='object')] are in the [columns]"
RuchiTanmay commented 1 month ago

Hi, Please Try with new version nselib 1.0 pip install nselib --upgrade