Skip to content
motorcycle_parts.ipynb
The most popular payment method motorcycle parts is transfers.
The highest average unit price has "Engine" prooduct line, and the lowest has "Breaking system".
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('data/sales_data.csv', parse_dates=['date'])
payment_method=df.groupby('payment')[['total']].sum()
payment_method.rename(columns={'total': 'Total'}, inplace=True)
display (payment_method)
payment_method.plot.bar(color="#004c6d")
plt.show
average_unit_price=df.groupby('product_line')[['unit_price']].mean()
average_unit_price.rename(columns={'unit_price': 'Average_unit_price'}, inplace=True)
display (average_unit_price)
ax=average_unit_price.plot.barh()
y=average_unit_price['Average_unit_price'].round(2)
for i, v in enumerate(y):
ax.text(v + 3, i + .25, str(v), color="#004c6d", fontweight='bold')
plt.show
#average purchase value by client type, total purchase value by product line, etc.