- Read in the state_fruit2 dataset and identify which columns need to be transformed and which ones do not:
>>> state_fruit2 = pd.read_csv('data/state_fruit2.csv')>>> state_fruit2
- Use the melt method by passing the appropriate columns to the id_vars and value_vars parameters:
>>> state_fruit2.melt(id_vars=['State'], value_vars=['Apple', 'Orange', 'Banana'])
- This one step creates tidy data for us. By default, melt refers to the transformed former column names as variable and the corresponding values as value. Conveniently, ...