In many use cases, different features of the same event are stored in a table by multiple rows. multiple columns will indicate each characteristics of one feature, such as name, value, timestamp, etc.
In machine learning, we need to aggregate them into one row for training, and the following shows how do do it in dataframe easily.
generate some example dataframe
import pandas as pd
data = [ ['1','name1','value1'],['1','name2','value2'],['1','name3','value3'], ['2','name1','value4'],['2','name2','value5'] ]
Reprint policy:
All articles in this blog are used except for special statements
CC BY 4.0
reprint policy. If reproduced, please indicate source
robot learner
!