Skip to content

Adding Insert() method to DataColumns to allow prepending data #5932

Open
@mihakralj

Description

@mihakralj

I am replacing a List datatype with DoubleDataFrameColumn datatype in existing app - where the list (holds historical data (for example bars with stock data). List.Insert(0,data) always prepends - it inserts new data on top, using List.Insert() method to insert new data in front instead at the back.

DataFrameColumn (and all other DataFrame types) need Insert() or Prepend() method (just like the List type) alongside currently implemented Append() method, allowing inserting new values to the top of the Column instead of appending data to the bottom.

If DataColumn cannot be assembled and filled in the reverse order (the latest data on top, the oldest at the bottom), the access will require lots of remediation code - checking the length of the Column to get the latest element, calculating the position of elements to get the slice of the last x entries...

Additional context
DoubleDataFrameColumn pd = new("Column");
df.Append(100.0); //appends data to the bottom
df.Insert(200.0,0); // should insert data at the top, just like the List method does

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions