I have a pandas dataframe that has one row per object. Within that object, there are subobjects. I want to create a dataframe which contains one row per subobject.
I've read stuff on melt but can't begin to work out how to use it for what I want to do.
I want to go from
ObjectID Sub1_ID Sub1_Var1 Sub1_Var2 Sub1_Var3 Sub2_ID Sub2_Var1 Sub2_Var2 Sub2_Var3
1 98398 3 10 9 19231 6 7 5
2 87868 8 5 4
3 4579 5 6 6 24833 6 2 2
4 2514 1 6 9
to
ObjectID Sub_ID Var1 Var2 Var3
1 98398 3 10 9
1 19231 6 7 5
2 87868 8 5 4
3 4579 5 6 6
3 24833 6 2 2
4 2514 1 6 9