Home > Software design >  Python: extract column from pandas pivot
Python: extract column from pandas pivot

Time:06-23

I have a pivoted table total_chart = df.pivot_table(index="Name", values="Items", aggfunc='count') The output gives

A              8
B             52
C             24
D              6
E             43
F              5
G             13
I              1

I trying to get only the second column (number only) Is there any simple way to get it?

CodePudding user response:

itemValues = df["Items"]
print(items)
print(df["Items"])

df['Items'].value_counts().sort_index(ascending=True).tolist()
  • Related