dotnet / dotnet/machinelearning

Adding Insert() method to DataColumns to allow prepending data

Open
#5,932 0 comments 0 reactions 0 assignees View on GitHub
area-DataFrame
Dominant language
C#
Stars
9.4k
Forks
2k
Avg merge
2d 20h
Merged PRs (30d)
11

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.