Reputation: 55
I have this type of dataframe which represents the label given by each annotator (column name) for a mention in a text (index):
My goal is to transform this view, to get the sum of the annotators for a label given at each mention of the text, as:
Will anyone have a lead for doing this? thanks in advance.
Upvotes: 0
Views: 34
Reputation: 14949
IIUC, you can try:
df = df.set_index('<your date column name>').apply(pd.Series.value_counts, 1).fillna(0)
Upvotes: 2