سؤال

I have a data like this:

enter image description here

I want to transpose it like this in python:

enter image description here

هل كانت مفيدة؟

المحلول

df.pivot_table(values='Confirmed',index['state','State_name'],columns='date',aggfunc='sum')
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى datascience.stackexchange
scroll top