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.41k stars 306 forks source link

how to append row to a empty dataframe? #197

Closed kkonghao closed 1 year ago

kkonghao commented 2 years ago

Hello thanks for your exciting dataframe library. I want to create an empty dataframe and append row contents row by row, like a stock's realtime minute open,high,low,close data. when i look for this library document i found no answer. could you provide an api like append_row() method for that purpose?

hosseinmoein commented 2 years ago

You can maintain references -- by using get_column() -- to the columns you want to update in real-time and just call _pushback().

Because the columns of a DataFrame could have different types an append_row() method cannot be implemented cleanly and efficiently.

kkonghao commented 2 years ago

yeah,thaks for your quick answer very much ,i think append a row like a map type into an exisit dataframe is necessary for this dataframe although it's efficiency is too slow. but in a dynamic production environment almost all data is row type not column type. Also pandas provide different methods to append row you can reference.

hosseinmoein commented 2 years ago

Yeah, I have to think about this. We don't want to have an convoluted and inefficient interface just for the sake having one

hosseinmoein commented 2 years ago

maybe something like load_data() would work

hosseinmoein commented 2 years ago

This (append_row()) has been implemented and added to master