From c4552e04e1271a9210a934233beae5be1943d034 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 7 Jun 2023 14:34:14 +0200 Subject: Writing User guide and use cases section. --- .../pandas_dataframe_conversion.md | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 docs/user_guide/timestamped_data/pandas_dataframe_conversion.md (limited to 'docs/user_guide/timestamped_data/pandas_dataframe_conversion.md') diff --git a/docs/user_guide/timestamped_data/pandas_dataframe_conversion.md b/docs/user_guide/timestamped_data/pandas_dataframe_conversion.md new file mode 100644 index 0000000..caddb11 --- /dev/null +++ b/docs/user_guide/timestamped_data/pandas_dataframe_conversion.md @@ -0,0 +1,31 @@ +Pandas dataframe conversion +=========================== + +A [Pandas dataframe](https://pandas.pydata.org/docs/getting_started/intro_tutorials/01_table_oriented.html#min-tut-01-tableoriented) is a python data structure allowing powerful table processings. + +[TimeStampedBuffer](/argaze/#argaze.DataStructures.TimeStampedBuffer) instance can be converted into dataframe provided that data values are stored as dictionaries. + +```python +from argaze import DataStructures + +# Create a timestamped data buffer +ts_data = DataStructures.TimeStampedBuffer() + +# Store various data as dictionary +ts_data[10] = {"A_key": 0, "B_key": 0.123}} +ts_data[20] = {"A_key": 4, "B_key": 0.567}} +ts_data[30] = {"A_key": 8, "B_key": 0.901}} +... + +# Convert timestamped data buffer into dataframe +ts_buffer_dataframe = ts_buffer.as_dataframe() +``` + +ts_buffer_dataframe would look like: + +|timestamp|A_key|B_key| +|:--------|:----|:----| +|10 |0 |0.123| +|20 |4 |0.567| +|30 |8 |0.901| +|... |... |... | \ No newline at end of file -- cgit v1.1