I have a dataframe:
df1 = pandas.DataFrame( {
"text" : ["Alice is in ", "Alice is in wonderland.", "Mallory has done the task.", "Mallory has", "Bob is final." , "Mallory has done"] ,
"label" : ["Seattle", "Portlang", "Gotland", "california", "california", "Portland"] ,
"title":["SA","SA","sometitle","sometitle","some different title","sometitle"],
"version":[1,2,4,1,2,3]})
df1
text label title version
0 Alice is in Seattle SA 1
1 Alice is in wonderland. Portlang SA 2
2 Mallory has done the task. Portland sometitle 4
3 Mallory has california sometitle 1
4 Bob is final. california some different title 2
5 Mallory has done Portland sometitle 3
I want to keep the title and text corresponding to the latest version number, also want to keep the labels in a list.
Thanks a lot,