Skip to content

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

Closed

Description

@synasius

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.

Activity

  1. added
    docs
    good first issue
    on Jul 1, 2019
  2. AndreasH96 commented on Dec 9, 2022

    @AndreasH96

    Is this issue still active? I'm interested in starting contributing and this seems like a good start 😄

  3. added a commit that references this issue on Oct 18, 2026
    e17da3c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions