Closed xkungfu closed 2 years ago
Currently, you can read/write DataFrame from/to a stream
See the documentation for read
and write
yes. I know this. but not understand what is stream. let me have a investigation. thank you!
It seems that the stream target is only std::cout or file.
It seems the dataframe data is split to pieces within the function "write" in "DataFrame_write.tcc", and store into a file piece by piece.
now I can use "write/read" to build a file based cache.
but my purpose is save to and read from redis.
so, how to catch all the data from the stream and store them into a std::string variable?
You need to study C++ iostream library. The DataFrame read
and write
are not restricted to files. They are based on streams.
a big challenge! as I saw in DataFrame_write.tcc, the dataframe was splitted to many parts. If I try to use iostream, Can I extract whole string from iostream one time, but not have to get every parts and organize them again?
You absolutely do not need to look at the code in DataFrame_write.tcc
. It just confuses you and it is irrelevant to what you want to do. You just need to look at its interface. The interface is based on iostreams. A stream could be many different things. It could be a file, console, socket, string, buffer, ....
To look at examples to learn is a very limited way of learning things. You need to learn the fundamentals of the language.
You keep asking me to teach you C++. I cannot do that
oh, yes that is. thank you very much. because I teach myself after hours, and build project directly without base knowledge, I often stuck by base problem.very sorry! I will go to learn iostream now.
@xkungfu ,
I implemented to_string()
and from_string()
over the weekend in master. If look you see how simple it is. It is literally 2 lines of code.
@xkungfu , I implemented
to_string()
andfrom_string()
over the weekend in master. If look you see how simple it is. It is literally 2 lines of code.
sorry for late to reply, because I was stucked by some other problems. I have found the way to convert df to string. but your way is the best. very simple very nice!
the problems are such as: how to convert pandas dataframe to hosseinmoein dataframe. I have got a solution. but don't know if it is right way. how to join multiple dataframes to a map or list, because I want sort them by some conditions. I am investigating about std::map or structs to do this work.
thank you for great work. it is beyond my imagination!
I want to store dataframe to redis and read it later. Is there a way like dataframe to string and dataframe from string?
thanks!