go-gota / gota

Gota: DataFrames and data wrangling in Go (Golang)
Other
2.98k stars 276 forks source link

Support Append data (new row) to a Series and/or DataFrame #73

Closed pjebs closed 4 years ago

pjebs commented 5 years ago

I can see that func (s *Series) Append(values interface{}) can be used to append data to the end of the Series.

How can I insert a new row at an arbitrary position?

It would be great to be able to do it for a DataFrame too. Not just for a Series.

pjebs commented 5 years ago

func (df DataFrame) Set(indexes series.Indexes, newvalues DataFrame) DataFrame seems to update existing rows at an arbitrary position.

pjebs commented 5 years ago

https://github.com/kniren/gota/issues/69#issuecomment-398107918 shows how to append. If you want to insert at arbitrary position, then you have to use the sort function which is slow and creates a copy of the DataFrame.

pjebs commented 5 years ago

I think it should operate like this package: https://github.com/rocketlaunchr/dataframe-go

mannharleen commented 4 years ago

@pjebs I ve created a PR with the relevant changes that would implement an insert at arbitrary position. Happy for feedback. If in doubt, checkout the tests for usage

mannharleen commented 4 years ago

Any specific reason for closing this issue?

pjebs commented 4 years ago

I created my own package: https://github.com/rocketlaunchr/dataframe-go I consider this package to be for all intents and purposes unmaintained.