Coder Social home page Coder Social logo

Comments (5)

rhinoV1 avatar rhinoV1 commented on August 17, 2024 1

OK, we managed to find what the problem was. I am running a newer version of python and pandas and one of them (probably pandas) has a problem with this part of the code:

def fixNansInX(x):
    '''
    Takes in x DataFrame, edits it so that important keys
    are 0 instead of NaN.
    '''
    keyCheckNullList = ["Short Term Debt" ,\
            "Long Term Debt" ,\
            "Interest Expense, Net",\
            "Income Tax (Expense) Benefit, Net",\
            "Cash, Cash Equivalents & Short Term Investments",\
            "Property, Plant & Equipment, Net",\
            "Revenue",\
            "Gross Profit",\
            "Total Current Liabilities",\
            "Property, Plant & Equipment, Net"]
    x[keyCheckNullList]=x[keyCheckNullList].fillna(0)

The problem is that "Property, Plant & Equipment, Net" appears twice in this list which causes the fixNansInX(x) function to crash. The solution is simple, just delete the last item in the keyCheckNullList and that is it.

Screenshot_1

And now everything works for me.

from build_your_own_ai_investor_2021.

Damonlee92 avatar Damonlee92 commented on August 17, 2024

Can you try running in this order?

fixNansInX(x_)
addColsToX(x_)
X=getXRatios(x_)
fixXRatios(X)

from build_your_own_ai_investor_2021.

rhinoV1 avatar rhinoV1 commented on August 17, 2024

Tried it, didn't help, same error. It seems as if the pandas library changed how fillna(0) works or something, I can't figure it out.

I extracted the code from the function fixNansInX(x) and tried running it step by step. Applying boolean masks works but when I need to replace the data it doesn't work and the error description doesn't make sense.
Screenshot_1
Screenshot_2
Screenshot_3

from build_your_own_ai_investor_2021.

Damonlee92 avatar Damonlee92 commented on August 17, 2024

Strange, it works for me. Email me on the protonmail address I'll give you a sample of the data that worked.

from build_your_own_ai_investor_2021.

Damonlee92 avatar Damonlee92 commented on August 17, 2024

ai_investor(at)protonmail.com

from build_your_own_ai_investor_2021.

Related Issues (5)

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.