occupationcoder icon indicating copy to clipboard operation
occupationcoder copied to clipboard

Convert to Python 3

Open aeturrell opened this issue 5 years ago • 4 comments

aeturrell avatar Jun 18 '20 09:06 aeturrell

capture

I try to run the code, but there was an error. How do I fix this? Thanks for your help

anita06172 avatar Apr 15 '21 01:04 anita06172

Hi @anita06172, this should be fixed in commit 41a214df36de98a67a116fbb34016c5183f0a302. You'll need to re-download and re-install. FYI the package has been upgraded to Python 3, and support for Python 2 has been dropped.

Can you let me know if it runs? Otherwise, let me know your OS, version of Python, and IDE.

aeturrell avatar Apr 15 '21 20:04 aeturrell

Thank you @aeturrell. It works for the script that I tried to run earlier. However, I tried to run the code with my owned data, there was another error, as followed. image image image Thanks again for your help!

anita06172 avatar Apr 16 '21 08:04 anita06172

Try running the script like this:

import pandas as pd
from occupationcoder.coder import coder

if __name__ == '__main__':
    myCoder = coder.Coder()
    df = pd.read_excel('excel_test.xlsx')
    df = df.fillna('')
    df = myCoder.codedataframe(df)
    print(df)
    ...

where you can add what you need at the end. NB: I tested this as a stand alone script but not in a Jupyter notebook.

aeturrell avatar Apr 18 '21 11:04 aeturrell