From 739e5fb7751f4ee4906fd81f2fbd11c4708217dc Mon Sep 17 00:00:00 2001 From: Tom Reincke Date: Mon, 20 Apr 2026 22:27:34 +0200 Subject: [PATCH] Adding something for the first commit --- test.py | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 test.py diff --git a/test.py b/test.py new file mode 100644 index 0000000..0fa422d --- /dev/null +++ b/test.py @@ -0,0 +1,78 @@ +#!/usr/bin/python3 + +# https://www.datacamp.com/tutorial/joining-dataframes-pandas +# Simples would be to simply join the dataframes coming from the loop, by the +# timestamp chris + +import pandas as pd + +a = [(1, 2), (2,3)] +b = [(1, 2), (2,3) ] + +a = pd.DataFrame.from_records(a,columns=["attr1", "attr2"]) +b = pd.DataFrame.from_records(b,columns=["attr3", "attr4"]) + +c = pd.concat([a,b], axis=1) + +print(c) + +## Example 2 + +print("###############################################") +print("###############################################") +print("###############################################") +print("###############################################") +print("###############################################") +print("###############################################") +print("###############################################") + +# Merge on attribute names, I would recommend this one + +a = [(1, 2), (2,3)] +b = [(1, 2, 1), (2,3, 1) ] + + +a = pd.DataFrame.from_records(a,columns=["attr1", "attr2"]) +b = pd.DataFrame.from_records(b,columns=["attr3", "attr4", "attr1"]) + +c = pd.merge(a,b, on="attr1") + +print(c) + +print("###############################################") +print("###############################################") +print("###############################################") +print("###############################################") +print("###############################################") +print("###############################################") +print("###############################################") + +a = [(1, 2), (2,3)] +b = [1 , 1] + +a = pd.DataFrame.from_records(a,columns=["attr1", "attr2"]) + +a["something"] = b + +print(a) + +print("###############################################") +print("###############################################") +print("###############################################") +print("###############################################") +print("###############################################") +print("###############################################") +print("###############################################") + +# This works too, but only if you have the same row size + +a = [(1, 2), (2,3)] +b = [(1, 2), (2,3) ] + +a = pd.DataFrame.from_records(a,columns=["attr1", "attr2"]) +b = pd.DataFrame.from_records(b,columns=["attr3", "attr4"] ) + +a["attr3"] = b["attr3"] + +print(c) +