How would I go about partitioning a column based on missing value in python.
I have have the following table in a dataframe:
Store Bag
Alberts ClothBag
Vons KateSpade
Ralphs GroceryBag1
Na apple
Na pear
Na staples
Kmart ShoppingList
Na beachball
Na milk
QuikEmart List5
Na Duff
Na Donuts
And based on the NA's or any other way, how would I reproduce the following table:
Store Bag Item
Alberts ClothBag ClothBag
Vons KateSpade KateSpade
Ralphs GroceryBag1 apple
Na GroceryBag1 pear
Na GroceryBag1 staples
Kmart ShoppingList beachball
Na ShoppingList milk
QuikEmart List5 Duff
Na List5 Dounuts
If there are no Na's beneath the store then the item column will assume the name of the Bag, as shown in the first two columns.