Git Product home page Git Product logo

ulist's People

Contributors

tushushu avatar yingmanwumen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

mejrs

ulist's Issues

Implement case-when methods

The case-when-then-else-end statement is supported by all the SQL databases, and it would be good if ulist can support this method.

Implement sum and mean methods for `BooleanList`

Actually, it does not makes sense to implement sum or mean methods for BooleanList because there is not addition or division methods for boolean type. We should write:

bool_list.astype('int').sum()
bool_list.astype('int').mean()

But people are quite comfortable to use sum or mean for BooleanList, so I have to compromise.

Implement apply method

Implement apply method like this:

>>> import ulist as ul

>>> arr = ul.arange(3)
>>> arr.apply(lambda x: x < 1)
UltraFastList([True, False, False])

Get elements by indexes

Get the ulist elements by multiple indexes, for example:

import ulist as ul

arr = ul.from_seq([1, 2, 3, 4, 5], dtype='int')
indexes = ul.IndexList([0, 2, 4])
arr[indexes]

[1, 3, 5]

Implement IndexList

The IndexList can slice the ulist array by its indexes. For example:

import ulist as ul
idx = IndexList([0, 2, 4])
arr = ul.from_seq([1, 2, 3, 5, 7, 11])
arr[idx]

[1, 3, 7]

Remove wish list

Currently, I use wish list to write down my new ideas. It's a bit awkward to use issues to manage these ideas, and it's just like one person talking to oneself.

Change replace method from an in-place method to a non-in-place method.

Try to reduce the numbers of in-place methods in ulist, because I personally think inplace method is not a good idea. For most of the case, we don't need to save memory so much. An 1d array/list should't crush your computer's memory. And in future, we can implement in-place mode for people who care about the memory that much.

Implement nth method for NumericalList

Partial sort the elements of NumericalList, for example:

import ulist as ul

arr = ul.from_seq([4, 2, 1, 3, 5, 0], dtype='int')
arr.partition(3)

[2, 1, 0, 3, 4, 5]

Types conversion

It is very common to implement types conversion for containers with different types. For example, pandas and numpy both implement astype method for Series and ndarray.

Remove unnecessary methods in Rust codes.

If a method can be implement by Python and almost has not overhead. Then we should consider move this method out of Rust codes. For example,

def mean(self):
    return self.sum() / self.size()

We only need to implement sum and size in rust and wrap them by Python. Then implement mean by "pure" Python codes.

Implement counter method for all the `List` except `FloatList`

This method return the elements stored as dictionary keys and their counts are stored as dictionary values.
For example:

[1, 1, 2, 2, 3] => {1: 2, 2: 2, 3: 1}

Note: f32 doesn’t implement Eq because NaN is not equal to itself, so it would be impossible to retrieve a HashMap entry with NaN as the key. So cannot implement the counter method for it now.

Implement StringList

Implement StringList to handle string type elements. Simply inherit the methods of List trait for the time being.

Implement where method for List

Like SQL WHERE statement, implement a where method to filter the ulist by given condition. For example:

arr = ul.arange(5)
arr.where(lambda x: x > 1)
UltraFastList([2, 3, 4])

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.