Code Monkey home page Code Monkey logo

Comments (4)

fkiraly avatar fkiraly commented on July 19, 2024

Ah, indeed! So you'd need to group it again before the bfill, right?

Would you like to open a PR with a fix? Seems like the correct diagnosis already!

Your example would also make a good test.

from sktime.

Ram0nB avatar Ram0nB commented on July 19, 2024

Ah, indeed! So you'd need to group it again before the bfill, right?

Would you like to open a PR with a fix? Seems like the correct diagnosis already!

Exactly! I'm happy to do so, I'll pick it up tomorrow.

from sktime.

fkiraly avatar fkiraly commented on July 19, 2024

Excellent.

Regarding the doc/logic mismatch, the standard way to address this is to change the doc, not the logic - to avoid to break currently working code.

Changing the logic can be done later, but should be accompanied by warnings etc - if we decide to do that.

from sktime.

cedricdonie avatar cedricdonie commented on July 19, 2024

EDIT: some profiling shows that the current solution is the fastest, even for a small dataframe. df.index.levels > 4 is approximately 1/3 slower than isinstance(df, MultiIndex):

>>> df = pd.DataFrame(dict(x=[1,2,3], y=[4,5,6]))
>>> timeit(lambda: isinstance(df, pd.MultiIndex), number=100000000)
6.388806922000015
>>> timeit(lambda: df.index.nlevels > 1, number=100000000)
9.203695821999986

Olde comment:
As a side-note, I'm not wasn't sure whether this is the best way to check for presence of a MultiIndex.

if isinstance(index, pd.MultiIndex):

elif isinstance(index, pd.MultiIndex):

from sktime.

Related Issues (20)

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.