Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Apply dict to map values #246

Open
Labels
enhancementImprove existing functionality or make things work betterlowpriority
@eriknw

Description

@eriknw

This is probably a crazy idea (and I don't currently have a use case), but could we make it easy to apply a dict to map values? For example, to make the following easier and more reliable (i.e., not rely on inlining the dict):

In [10]:v=gb.Vector.from_values(np.arange(5),np.arange(5))In [11]:vOut[11]:"v_2"nvalssizedtypeformatgb.Vector55INT64full-------------------------------------index01234value01234In [12]:v.apply(lambdax: {0:0,1:2,2:4,3:6,4:8}[x]).new()Out[12]:"v_4"nvalssizedtypeformatgb.Vector55INT64full-------------------------------------index01234value02468

This requires Numba to know the types of the dictionary. Also, I don't know how easy it would be to have a default value. This may require its own method.

This is inspired by the Pandas functionality to be able to usex.map(d) to apply a dict or Series mapping.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprove existing functionality or make things work betterlowpriority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp