hosseinmoein / DataFrame

C++ DataFrame for statistical, Financial, and ML analysis -- in modern C++ using native types and contiguous memory storage
https://hosseinmoein.github.io/DataFrame/
BSD 3-Clause "New" or "Revised" License
2.45k stars 310 forks source link

Any efficient way to replace a particular column value( for example by index) without replacing all column values? #229

Closed sierret closed 1 year ago

sierret commented 1 year ago

I was looking for a way to replace an exist column (or row) value? From what I see in the docs, I'd have to reload/replace the entire column with the single adjusted value. Either that or I'd have to delete the entire row and add the new row? Is there an more efficient way to do this that allows only replace on the single row value? Did I miss something?

hosseinmoein commented 1 year ago

You don't need to replace the row or column. The docs are here https://htmlpreview.github.io/?https://github.com/hosseinmoein/DataFrame/blob/master/docs/HTML/DataFrame.html

Simply call get_column() or get_row() which returns a reference to a column or a row. Then change whatever you want

sierret commented 1 year ago

Oh, it returns a reference! I thought it returned a copy. Thanks!