anoopkunchukuttan / indic_nlp_library

Resources and tools for Indian language Natural Language Processing
http://anoopkunchukuttan.github.io/indic_nlp_library/
MIT License
546 stars 158 forks source link

loaderload() fails in latest pandas #32

Closed sayanb-7c6 closed 3 years ago

sayanb-7c6 commented 3 years ago

Hi, I've Pandas 1.0.4 installed and if I try to execute the following code, it shows be the error AttributeError: 'DataFrame' object has no attribute 'ix', which is because ix is deprecated.

from indicnlp import loader
loader.load()

Full stacktrace of the error.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-6-5f49d51c6132> in <module>
      1 from indicnlp import loader
----> 2 loader.load()

~/anaconda3/envs/nlp_bert/lib/python3.6/site-packages/indicnlp/loader.py in load()
     25 
     26     ## Initialization of Indic scripts module
---> 27     indic_scripts.init()
     28 
     29     ## Initialization of English scripts module

~/anaconda3/envs/nlp_bert/lib/python3.6/site-packages/indicnlp/script/indic_scripts.py in init()
    104     TAMIL_PHONETIC_DATA=pd.read_csv(os.path.join(common.get_resources_path(),'script','tamil_script_phonetic_data.csv'),encoding='utf-8')
    105 
--> 106     ALL_PHONETIC_VECTORS= ALL_PHONETIC_DATA.ix[:,PHONETIC_VECTOR_START_OFFSET:].as_matrix()
    107     TAMIL_PHONETIC_VECTORS=TAMIL_PHONETIC_DATA.ix[:,PHONETIC_VECTOR_START_OFFSET:].as_matrix()
    108 

~/anaconda3/envs/nlp_bert/lib/python3.6/site-packages/pandas/core/generic.py in __getattr__(self, name)
   5272             if self._info_axis._can_hold_identifiers_and_holds_name(name):
   5273                 return self[name]
-> 5274             return object.__getattribute__(self, name)
   5275 
   5276     def __setattr__(self, name: str, value) -> None:

AttributeError: 'DataFrame' object has no attribute 'ix'

Any chance of making it compatible with pandas >= 1.0 in near future?

One more issue is, I saw this line in the sample notebook that you're using: sys.path.append(r'{}\src'.format(INDIC_NLP_LIB_HOME)). But if I look into the repo there is no src folder in the top level dir. Probably it needs to get updated.

anoopkunchukuttan commented 3 years ago

I have already fixed this: #20. Are you using the pip package? Probably not updated that - will do it. You can pull the latest code. Yeah, I will update the notebook too. The code has been refactored.

sayanb-7c6 commented 3 years ago

Hi, thank you for the quick response. Yes, I was using the pip package from Dec '19. For now I've downgraded pandas in a separate conda env and it's working. On the same note, would you be accepting pull requests in this repo? Because I'm currently working in NLP and would like to contribute to this project, if you're okay with it.

anoopkunchukuttan commented 3 years ago

Yes, I would be happy to accept contributions. Particularly stuff that can scale to multiple languages.

anoopkunchukuttan commented 3 years ago

pypi package updated. Version 0.71