Create tuples of column names and last value from each value in a dataframe
Suppose the interface is outputting the pandas framework like
df
A B
0 1 4
1 2 5
2 3 6
And for further processing, only tuples are needed consisting of the column name and the last value of each column, i.e.
A_tuple
('A', 3)
B_tuple
('B', 6)
How can I get these tuples in a concise manner from the original frame?
+3
source to share
3 answers