Update folder structure

This commit is contained in:
Kristofers Solo
2021-12-01 13:07:11 +02:00
parent 52d2935087
commit 2eb3f800d6
10 changed files with 2 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
month_number,facecream,facewash,toothpaste,bathingsoap,shampoo,moisturizer,total_units,total_profit
1,2500,1500,5200,9200,1200,1500,21100,211000
2,2630,1200,5100,6100,2100,1200,18330,183300
3,2140,1340,4550,9550,3550,1340,22470,224700
4,3400,1130,5870,8870,1870,1130,22270,222700
5,3600,1740,4560,7760,1560,1740,20960,209600
6,2760,1555,4890,7490,1890,1555,20140,201400
7,2980,1120,4780,8980,1780,1120,29550,295500
8,3700,1400,5860,9960,2860,1400,36140,361400
9,3540,1780,6100,8100,2100,1780,23400,234000
10,1990,1890,8300,10300,2300,1890,26670,266700
11,2340,2100,7300,13300,2400,2100,41280,412800
12,2900,1760,7400,14400,1800,1760,30020,300200
1 month_number facecream facewash toothpaste bathingsoap shampoo moisturizer total_units total_profit
2 1 2500 1500 5200 9200 1200 1500 21100 211000
3 2 2630 1200 5100 6100 2100 1200 18330 183300
4 3 2140 1340 4550 9550 3550 1340 22470 224700
5 4 3400 1130 5870 8870 1870 1130 22270 222700
6 5 3600 1740 4560 7760 1560 1740 20960 209600
7 6 2760 1555 4890 7490 1890 1555 20140 201400
8 7 2980 1120 4780 8980 1780 1120 29550 295500
9 8 3700 1400 5860 9960 2860 1400 36140 361400
10 9 3540 1780 6100 8100 2100 1780 23400 234000
11 10 1990 1890 8300 10300 2300 1890 26670 266700
12 11 2340 2100 7300 13300 2400 2100 41280 412800
13 12 2900 1760 7400 14400 1800 1760 30020 300200

View File

@@ -0,0 +1,100 @@
# Author - Kristiāns Francis Cagulis
# Date - 22.11.2021
import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_csv("company_sales_data.csv")
def task_1():
plt.figure(figsize=(10, 6)) # (x, y)
x = range(len(data["month_number"])) # gets range of months
plt.plot(x, data["total_profit"]) # sets up the plot
plt.xticks(x, data["month_number"], fontsize=15) # sets x value step
plt.yticks(fontsize=15)
plt.ylim(ymin=100000) # sets minimal y value
set_labels("Company profit per month", "Month number", "Total profit")
plt.show()
def task_2():
plt.figure(figsize=(10, 6)) # (x, y)
x = range(len(data["month_number"])) # gets range of months
data_list = list(data.columns)[1:-2] # gets and trims column names
for column in data_list:
plt.plot(x, data[column], lw=4, marker='o', ms=10) # ms = marker size
plt.xticks(x, data["month_number"], fontsize=15) # sets x value step
plt.yticks(fontsize=15)
set_labels("Sales data", "Month number", "Sales units in number")
new_data_list = list(map(lambda x: x.capitalize() + " Sales Data", data_list)) # capitalizes each word in list
plt.legend(new_data_list, loc='upper left', fontsize=15)
plt.show()
def task_3():
plt.figure(figsize=(10, 6)) # (x, y)
x = range(len(data["month_number"])) # gets range of months
plt.scatter(x, data["toothpaste"], s=75) # sets up the plot
plt.grid(ls='dashed', lw=1.5) # sets grid line type and width
plt.xticks(x, data["month_number"], fontsize=15) # sets x value step
plt.yticks(fontsize=15)
set_labels("Toothpaste Sales data", "Month number", "Number of units Sold")
plt.legend(["Toothpaste Sales data"], loc='upper left', fontsize=15)
plt.show()
def task_4():
items = ["facecream", "facewash"]
data.plot(x="month_number", y=["facecream", "facewash"], kind='bar', figsize=(10, 6), fontsize=15)
plt.xticks(rotation=0) # rotates x lables to 0
plt.grid(ls='dashed', lw=1.5) # sets grid line type and width
set_labels("Facewash and Facecream Sales data", "Month number", "Sales units in number")
new_items_list = list(map(lambda x: x.capitalize() + " Sales Data", items))
plt.legend(new_items_list, loc='upper left', fontsize=15)
plt.show()
def set_labels(title: str, xlabel: str, ylabel: str):
plt.title(title, fontsize=15)
plt.xlabel(xlabel, fontsize=15)
plt.ylabel(ylabel, fontsize=15)
def main():
task = input(
"""Ivēlieties uzdevumu:
1 - pirmais uzdevums
2 - otrais uzdevums
3 - trešais uzdevums
4 - ceturtais uzdevums
"""
)
if task == "1":
task_1()
elif task == "2":
task_2()
elif task == "3":
task_3()
elif task == "4":
task_4()
else:
print("Tika ievadīts nepareiz cipars")
if __name__ == '__main__':
main()