Pivoting a Pandas Dataframe containing strings – ‘No numeric types to aggregate’ error
The default aggfunc in pivot_table is np.sum and it doesn’t know what to do with strings and you haven’t indicated what the index should be properly. Trying something like: pivot_table = unified_df.pivot_table(index=[‘id’, ‘contact_id’], columns=”question”, values=”response_answer”, aggfunc=lambda x: ‘ ‘.join(x)) This explicitly sets one row per id, contact_id pair and pivots the set of response_answer values … Read more