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,23 @@
1. Datu bāze ir organizēts strukturētas informācijas jeb datu kopums, kas parasti elektroniski tiek glabāts datorsistēmā
2. pandas ir datu analīzes un manipulācijas bibliotēka
3. matplotlib ir bibliotēka statisku, animētu un interaktīvu vizualizāciju izveidei
4. seaborn padara matplotlib sarežģītākos momentus par vienkāršākiem
5. 1048576 rindas, 16384 kolonnas
6. RAM, statistikas datu apjoms,
7. līniju diagramma - vairāku cieši saistītu datu sēriju attēlošana
stabiņu diagramma - datu izmaiņas noteiktā laika periodā vai salīdzinājuma attēlošana
riņķa diagramma - vizuālai salīdzināšanai, cik liela datu daļa atbilst katrai datu kategorijai
histogramma - datu kopas sadalījuma attēlošanai
8. viegli
9. no .csv faila nolasīt attiecīgās valsts nosaukumu, vidējo mirstības rādītāju, max un min mirstības rādītājus un attiecīgo pēdējo gadu, kad ir dati.
Izmantojot bibliotēkas pandas, seaborn un holoviews, izveidot pasaules kartes diagrammu.
Informācijas avoti:
https://pypi.org/project/pandas/
https://pypi.org/project/matplotlib/
https://pypi.org/project/seaborn/
https://pypi.org/project/holoviews/
https://support.microsoft.com/en-us/office/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3
https://www.who.int/data/gho/data/indicators/indicator-details/GHO/mortality-rate-for-5-14-year-olds-(probability-of-dying-per-1000-children-aged-5-14-years)

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()

View File

@@ -0,0 +1,29 @@
from audioop import add
from ctypes import addressof
from bs4 import BeautifulSoup
import requests
url = "https://en.wikipedia.org/wiki/Husky"
all_page = requests.get(url)
# print(all_page)
if all_page.status_code == 200:
print(":)")
page = BeautifulSoup(all_page.content, 'html.parser')
found = page.find(id="Etymology")
# print(found)
# print(found.constents)
# print(found.string)
found = page.find_all(class_="mw-headline")
# print(found)
found = page.find_all("li", class_="interlanguage-link")
# print(found)
found = page.find_all("a", class_="interlanguage-link-target")
# print(found)
for i in found:
# print(i.prettify())
if i.attrs["lang"] == "ru":
print(f"{i.attrs['lang']} \t {i.attrs['title']} \n {i.attrs['href']}")
else:
print(":(")

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
# Author - Kristiāns Francis Cagulis
# Date - 06.10.2021
import re
CHAPTERS = 61
# creates file with chapters and row numbers
def read_array(document):
with open(document, "r", encoding='utf-8') as book:
lines = [line.strip('\n') for line in book] # removes 'enter' characters
with open('array_output.txt', 'w') as output:
for i in range(1, CHAPTERS + 1):
line = lines.index(f"Chapter {i}") + 1 # finds all chapter indexes/lines
output.write(f"Line {line} - Chapter {i}\n") # writes line in file
# creates file with chapter positions
def read_string(document):
with open(document, "r", encoding='utf-8') as book:
lines = book.read()
with open('str_output.txt', 'w') as output:
for i in range(1, CHAPTERS + 1):
_, position = re.finditer(rf"\bChapter {i}\b", lines) # finds all chapter positions
output.write(f"Position {position.start()} - Chapter {i}\n") # writes position in file
def read_book(document):
read_array(document)
read_string(document)
def main():
try:
read_book("book.txt")
except:
try:
read_book("1342-0.txt")
except:
read_book(input("Ievadiet faila nosaukumu: "))
if __name__ == '__main__':
main()