How can I get percent off different Ship Mode?
df3.groupby('Ship Mode')['Ship Mode'].count()
CodePudding user response:
df3.groupby('Ship Mode')['Ship Mode'].count() / len(df3)
CodePudding user response:
df3.groupby('Ship Mode')['Ship Mode'].count()/df3.shape[0]
CodePudding user response:
Try this,
df3['Ship Mode'].value_counts(normalize=True)
Use Value counts and pass normalization.
Value Counts: https://pandas.pydata.org/docs/reference/api/pandas.Series.value_counts.html