Followers

Saturday 30 September 2017

Partion a column based on missing values

Source: stackoverflow.com --- Friday, September 29, 2017
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. ...



from Apple http://ift.tt/2xJGoa0

No comments:

Post a Comment