Driven by Ted Petrou's Minimally Sufficient Pandas approach I will also preach that I as well feel strongly that Minimally Sufficient Pandas is a useful guide for those wanting to increase their effectiveness at data analysis without getting lost in the syntax.
Let’s use the pivot method to reshape this data so that the
purpose of the wells become columns names and the
water_depth becomes their respective values.
Guidance — Consider using only
pivot_table and not
pivot_table can accomplish all of what
pivot can do. In the case that you do not need to perform an aggregation, you still must provide an aggregation function.
purpose has 3 values - WILDCAT, APPRAISAL and WILDCAT-CCS so we are expecting 3 new columns after applying
Now we will go back to the original long format.
In addition we will drop values where