mars-project / mars-project/mars

Support `mt.coo` to create a dense or sparse tensor from COOrdinate format

Open
#2,006 0 comments 0 reactions 0 assignees View on GitHub
mod: tensor type: feature
Dominant language
Python
Stars
2.7k
Forks
325
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**

Given the situation that Mars tensor doesn't support `__setitem__` with multiple fancy indexes(and it's relatively hard to implement), thus it's hard to turn a DataFrame which organized with COOrdinate format data into a tensor.

Hence, I propose to provide a `mt.coo` API to address this issue. API likes:

```
t = mt.coo(data, [i, j], shape=None, dtype=None, sparse=True)
```

where `data`, `i`, `j` are 1-d array-like data.

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing Mars tensor constructors and sparse-tensor support, then compare their handling of one-dimensional array-like inputs. Define the `mt.coo(data, [i, j], shape=None, dtype=None, sparse=True)` behavior for dense and sparse results, including shape and dtype defaults, and add coverage for the proposed coordinate-format inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.