1. 程式人生 > >Pandas for beginners: How to handle real-life data

Pandas for beginners: How to handle real-life data

4) Reshape Your Data Frame

In real life, unlike the most famous datasets such as the Irises flowers, Titanic passengers, or Boston house prices, yours will need a little more work before you can start to dive into analysis and model training. Likely, you will have to reshape your data frame.

My data frame, as for now, can not be used to train a model because I have several rows for each user. Furthermore, I cannot perform analysis about which newsletters are the most useful because I have a row for each newsletters of every users.

I need to reshape it using a pivot table to have each newsletter as a column and only one row per user: