Compare commits
No commits in common. "978db954d21352adf14bff9eeaaa16897baf6f61" and "86d0d6582d4fa68fcd1b442bf17640f4c4c2df2c" have entirely different histories.
978db954d2
...
86d0d6582d
@ -1,13 +0,0 @@
|
|||||||
from analysis.io import load_sales
|
|
||||||
from analysis.metrics import revenue_per_day
|
|
||||||
from analysis.plotting import plot_daily_revenue
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
|
||||||
df = load_sales("resources/sales.csv")
|
|
||||||
daily = revenue_per_day(df)
|
|
||||||
plot_daily_revenue(daily)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
import pandas as pd
|
|
||||||
|
|
||||||
|
|
||||||
def load_sales(path: str) -> pd.DataFrame:
|
|
||||||
return pd.read_csv(path, sep=",", encoding="utf-8")
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
import pandas as pd
|
|
||||||
|
|
||||||
|
|
||||||
def revenue_per_day(df: pd.DataFrame) -> pd.Series:
|
|
||||||
revenue = df["quantity"] * df["unit_price"]
|
|
||||||
return revenue.groupby(df["day"]).sum()
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
import matplotlib.pyplot as plt
|
|
||||||
import pandas as pd
|
|
||||||
|
|
||||||
|
|
||||||
def plot_daily_revenue(daily: pd.Series) -> None:
|
|
||||||
daily.plot(kind="bar")
|
|
||||||
plt.title("Daily Revenue")
|
|
||||||
plt.tight_layout()
|
|
||||||
plt.show()
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
day,product,quantity,unit_price,region
|
|
||||||
Mon,Notebook,3,899.0,West
|
|
||||||
Mon,Mouse,12,25.0,West
|
|
||||||
Tue,Notebook,2,899.0,Ost
|
|
||||||
Tue,Keyboard,5,70.0,Ost
|
|
||||||
Wed,Monitor,4,220.0,West
|
|
||||||
Wed,Mouse,10,25.0,Nord
|
|
||||||
Thu,Keyboard,6,70.0,Sued
|
|
||||||
Thu,Monitor,3,220.0,Ost
|
|
||||||
Fri,Notebook,1,899.0,Nord
|
|
||||||
Fri,Mouse,15,25.0,Sued
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user