Code Monkey home page Code Monkey logo

Comments (6)

NarenInD avatar NarenInD commented on September 25, 2024 2

Even after updating pandas to 1.1.1 , I had the same Type error issue.

After updating the code as @dsevero suggested, It works fine.

Thanks

from icd-prediction-mimic.

dsevero avatar dsevero commented on September 25, 2024

Hi, @NarenInD. Thanks for reaching out.

Judging from the error message, it might be an issue with the version of pandas. Would you mind telling us what version you are using? You can check it by running import pandas; print(pandas.__version__) in the python interpreter.

@arthurreys it might be safer to replace

df.query("HADM_ID.isin(@hadm_ids[0])")

with

df[df['HADM_ID'].isin(hadm_ids[0])]

@NarenInD you can also try the above to see if it helps.

from icd-prediction-mimic.

NarenInD avatar NarenInD commented on September 25, 2024

@dsevero

The pandas version is 0.25.3

Also , I replaced the following line as you suggested, but didn't work. It throws NameError: name 'df' is not defined

self.all_icds_train = utils.make_icds_histogram(self.df.query("HADM_ID.isin(@hadm_ids[0])")).index.tolist()

self.all_icds_train = utils.make_icds_histogram(self.df[df['HADM_ID'].isin(hadm_ids[0])]).index.tolist()

The same mutable issue also gets arised in this line of dataset.py

((self.x_train, self.y_train),
         (self.x_val, self.y_val),
         (self.x_test, self.y_test)) = [
             (self.df.query("HADM_ID.isin(@ids)").TEXT, 
             self.mlb.transform(self.df.query("HADM_ID.isin(@ids)").ICD9_CODE))
             for ids in hadm_ids
             ]

from icd-prediction-mimic.

dsevero avatar dsevero commented on September 25, 2024

@NarenInD, in the first case it should be:

self.df[self.df['HADM_ID'].isin(hadm_ids[0])]

in the second, use this:

((self.x_train, self.y_train),
         (self.x_val, self.y_val),
         (self.x_test, self.y_test)) = [
             (self.df[self.df['HADM_ID'].isin(ids)].TEXT, 
             self.mlb.transform(self.df[self.df['HADM_ID'].isin(ids)].ICD9_CODE))
             for ids in hadm_ids
             ]

have you tried updating your pandas version with pip or conda?

with pip: pip install --upgrade pip

from icd-prediction-mimic.

arthurreys avatar arthurreys commented on September 25, 2024

Hello @NarenInD!

I've created a new branch issue-5 and added the suggested changes from @dsevero. You can checkout to that branch in order to test the modifications.

As already stated, you could also try updating your current pandas version.

Please let us know if it works for you!

from icd-prediction-mimic.

dsevero avatar dsevero commented on September 25, 2024

Good to know! If anything else comes up, let us know :)

from icd-prediction-mimic.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.