How to get percentage of different shipment mode in pandas?
Question:
Answers:
df3.groupby('Ship Mode')['Ship Mode'].count() / len(df3)
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
df3.groupby('Ship Mode')['Ship Mode'].count()/df3.shape[0]
df3.groupby('Ship Mode')['Ship Mode'].count() / len(df3)
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
df3.groupby('Ship Mode')['Ship Mode'].count()/df3.shape[0]