In relation to [this question][1], is there a way to move akas and lqakas if they are not None below each Primary name and also assign the Name Type to be AKA or LQAKA if the AKA/LQAKA contain list. Bear in mind I have a looot of extra columns columns like Other.
import pandas as pd
data = {'Name Type': ["Primary", "Primary", "Primary"],
'Full Name': ["John Snow", "Daenerys Targaryen", "Brienne Tarth"],
'AKA': [["Aegon Targaryen", "Lord Snow"], None, None],
'LQAKA': ["The Bastard of Winterfell", ["Mother of Dragons", "The Unburnt"],
None],
'Other': ["Info", "Info", "Info"]}
df = pd.DataFrame(data)
Expected results:
I opened a [similar question][1] before and it was answered. I used the code below and it worked well. But now I have lists of names instead of single string in AKAs and LQAKAs.
[1]: /questions/78364978/move-specific-column-information-to-a-new-row-under-the-current-row