Solution: Reshaping/Aggregations
See the solution to the problems related to reshaping/aggregations.
We'll cover the following...
Solution 1
Look at the following dataset:
Age 8 10 15 15 72 20 25 30 35 60 68 70 25 85 15Sex M M F F M M M M F F M F F M F
Create dummy columns on the Sex
attribute.
Press + to interact
import pandas as pddf=pd.DataFrame({"Age": [8,10,15,15,72,20,25,30,35,60,68,7,25,85,15],"Sex" : ['M','M','F','F','M','M','M','M','F','F','M','F','F','M','F']})encoded = pd.get_dummies(df["Sex"])print(encoded)
Line 7: We use the ...