Giter Site home page Giter Site logo

Comments (3)

cjrh avatar cjrh commented on July 23, 2024

Hi @Umesh-JNU

Thank you for your report.

I notice that you're directly calling a function called bucket(). This library, excitertools does not have such a free-standing function. I assume you're talking about more-itertools.bucket(), which is over here: https://github.com/more-itertools/more-itertools

Nevertheless, I looked into this, using both more-itertools and this library, excitertools. In fact, excitertools simply wraps many of the functions in more-itertools so we would expect the same behaviour in both.

To try to reproduce your example, I did this:

more-itertools

>>> iterable = ['a1', 'b1', 'c1', 'a2', 'b2', 'c2', 'b3']
>>> key = lambda x: x[0]                                 
>>> s = more_itertools.bucket(iterable, key=key)         
>>> sorted(s)                                            
['a', 'b', 'c']                                          
>>> list(s['a'])                                         
['a1', 'a2']            

excitertools

>>> iterable = ['a1', 'b1', 'c1', 'a2', 'b2', 'c2', 'b3']
>>> b = Iter(iterable).bucket(key=lambda x: x[0])        
>>> sorted(b)                                            
['a', 'b', 'c']                                          
>>> list(b['a'])                                         
['a1', 'a2']                                             

Thus, I did not get the error in either case.

Looking more closely at your code, the line that complains is this:

s = bucket(iterable, key=lambda x: x[0])

And the error message given is that 'str' object is not callable. The only thing on that line appears to be callable is the identifier bucket, which makes me think that somehow your identifier bucket has somehow been initialised as a string, and not the function from more-itertools.

If you could provide a short, self-contained example of code that I can run, and produce the error, that will help. Please do not link to a notebook.

from excitertools.

Umesh-JNU avatar Umesh-JNU commented on July 23, 2024

from excitertools.

cjrh avatar cjrh commented on July 23, 2024

No worries, I can just close it here 👍🏼

from excitertools.

Related Issues (13)

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.