dpilger26 / NumCpp

C++ implementation of the Python Numpy library
https://dpilger26.github.io/NumCpp
MIT License
3.58k stars 555 forks source link

Update all rows in particular column in NdArray #172

Closed serhii-vlasiuk closed 1 year ago

serhii-vlasiuk commented 1 year ago

I have nc::NdArray like: [a b c d] [a1 b1 c1 d1] [a2 b2 c2 d2] [a3 b3 c3 d3]

Is it possible to update all rows for first or other columns? And get the following result: [a_new b c d] [a_new1 b1 c1 d1] [a_new2 b2 c2 d2] [a_new3 b3 c3 d3]

dpilger26 commented 1 year ago

There are a lot of overloads of the NdArray put() method for inserting values. Specifically you'll want this one

arr.put(arr.rSlice(), 0, values);