Add an example for an equivalent of numpy's column_stack function in ndarray_for_numpy_users

Open
#650 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
45/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Tech stack
rust
Domain
documentation

Research direction

Start in the ndarray_for_numpy_users documentation section and compare its existing examples with NumPy's column_stack reference. Add a documented Rust example based on stack(Axis(1), ...), with the work complete when the section clearly shows the equivalent operation.

Written by the indexing model from the issue text.

Description

docs good first issue

I was looking for an equivalent function of numpy's column_stack (see https://docs.scipy.org/doc/numpy/reference/generated/numpy.column_stack.html) in ndarray docs.

This is how I managed to solve the issue:

use ndarray::{Array, Axis, stack, arr2};

let a = Array::linspace(0., 1., 5).into_shape((5,1)).unwrap();
let b = Array::<f64, _>::ones((5, 1));
let res = stack(Axis(1), &[b.view(), a.view()]);
assert!(res == Ok(arr2(&[[1., 0.],
                 [1., 0.25],
                 [1., 0.5],
                 [1., 0.75],
                 [1., 1.]])));

It could be worth to have an example in ndarray_for_numpy_users section of the docs.

Dominant language
Rust
Stars
4.3k
Forks
391
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-ndarray/ndarray

All issues in rust-ndarray/ndarray

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.