Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d38c312
Merge pull request #1 from abador/master
lukaszbajkowski Apr 2, 2020
cd685b5
dodanie printa
lukaszbajkowski Apr 2, 2020
498bd2c
dodanie zmiennej test i przypisanie jej wartosci 4
lukaszbajkowski Apr 2, 2020
8319df3
Dodanie pliku
lukaszbajkowski Apr 3, 2020
dd7be0b
Update cw_2.py
lukaszbajkowski Apr 3, 2020
3a3a778
Dodanie pliku
lukaszbajkowski Apr 3, 2020
ab803ac
Modtfikacja zadania 15
lukaszbajkowski Apr 4, 2020
3e6314a
Wykonanie zadan
lukaszbajkowski Apr 17, 2020
e3792e3
Wykonanie zadan
lukaszbajkowski Apr 17, 2020
2578931
Delete python.py
lukaszbajkowski Apr 24, 2020
ad0a5ad
Update README.md
lukaszbajkowski Apr 24, 2020
c396311
Optymalizacja
lukaszbajkowski Apr 24, 2020
628f958
wd_cw04
lukaszbajkowski Apr 24, 2020
2ae5885
wd_cw04
lukaszbajkowski Apr 24, 2020
59bfb5e
wd_cw04
lukaszbajkowski Apr 28, 2020
35a5b67
wd_cw05
lukaszbajkowski May 8, 2020
ac2eeae
wd_cw06
lukaszbajkowski May 12, 2020
38f455b
wd_cw06
lukaszbajkowski May 17, 2020
3f35341
wd_cw06
lukaszbajkowski May 17, 2020
0ff1d5f
wd_cw07
lukaszbajkowski May 18, 2020
51ee33d
wd_cw08
lukaszbajkowski May 27, 2020
024347a
wd_cw06
lukaszbajkowski Jun 11, 2020
bdfa670
wd_cw08
lukaszbajkowski Jun 11, 2020
8f8c875
wd_cw08
lukaszbajkowski Jun 11, 2020
a962e0f
wd_cw08
lukaszbajkowski Jun 11, 2020
a5639d3
wd_cw08
lukaszbajkowski Jun 11, 2020
c2512b6
Merge remote-tracking branch 'origin/problem' into problem
lukaszbajkowski Jun 11, 2020
5c3531b
wd_cw10
lukaszbajkowski Jun 11, 2020
5fb3875
wd_kol_2_3
lukaszbajkowski Jun 11, 2020
3f27e87
wd_kol_2_3
lukaszbajkowski Jun 11, 2020
547b3d9
wd_kol_2_3
lukaszbajkowski Jun 11, 2020
0cfe331
Delete Imiona_nadane_wPolsce_w_latach_2000-2019.csv
lukaszbajkowski Jun 11, 2020
85bcc87
Delete zamówienia_2004.csv
lukaszbajkowski Jun 11, 2020
dd51180
Delete zamówienia_2005.csv
lukaszbajkowski Jun 11, 2020
59936d8
wd_cw08
lukaszbajkowski Jun 11, 2020
554754f
wd_kol_ropiak
lukaszbajkowski Jun 11, 2020
0d4caa1
wd_kol_1
lukaszbajkowski Jun 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24,462 changes: 24,462 additions & 0 deletions Imiona_nadane_wPolsce_w_latach_2000-2019.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# WD2020
Data visualisation classes zmiana 1 zmiana 222 zmiana 333
Data visualisation classes
1 change: 1 addition & 0 deletions ciagi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__all__ = ["arytmetyczne", "geometryczny"]
5 changes: 5 additions & 0 deletions ciagi/arytmetyczne.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def wyraz_ciagu(n = 1, a1 = 1, r = 1):
return a1 + (n - 1) * r

def n_wyrazow_ciagu(n = 1, a1= 1, an = 1):
return (a1 + an) / 2 * n
8 changes: 8 additions & 0 deletions ciagi/geometryczny.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def wyraz_ciagu(n = 1, a1 = 1, q = 1):
return a1 * pow(q, n-1)

def n_wyrazow_ciagu(n = 1, a1= 1, q = 1):
if q == 1:
return a1 * n
else:
return a1 * (1 - pow(q, n)) / (1 - q)
143 changes: 143 additions & 0 deletions cw_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
import math
import string
# ZADANIE 1
a, b = 3, 5
print(a, b)
c, d = 3.22 , 4.44
print(c, d)
e, f = 'KOt', "plot"
print(e, f)
g, h = 4j + 2, 2.2 + 5j
print(g, h)

# ZADANIE 2
x = int(input("Podaj liczbe: "))
y = int(input("Podaj liczbe: "))
dodawanie = x + y
print('Suma: %(zmienna)d' %{'zmienna' : dodawanie})
odejmowanie = x - y
print('Róznica: %(zmienna)d' %{'zmienna' : odejmowanie})
mnozenie = x * y
print('Iloczyn: %(zmienna)d' %{'zmienna' : mnozenie})
dzielenie = x / y
print('Iloraz: %(zmienna)d' %{'zmienna' : dzielenie})
dzielenie_calkowite = x // y
print('Dzielenie całkowite: %(zmienna)d' %{'zmienna' : dzielenie_calkowite})
reszta = x % y
print('Reszta z dzielenia: %(zmienna)d' %{'zmienna' : reszta})
potegowanie = x ** y
print('Potęgowanie: %(zmienna)d' %{'zmienna' : potegowanie})
potegowanie = pow(x,y)
print('Potęgowanie: %(zmienna)d' %{'zmienna' : potegowanie})

# ZADANIE 3
i = int(input(u"\nPodja liczbę: "))
i += 2
print(i)
i -= 2
print(i)
i *= 2
print(i)
i /= 2
print(i)
i **= 2
print(i)
i %= 2
print(i)

# ZADANIE 4
zmienna1 = math.pow(math.log(5 + pow(math.sin(8), 2), math.e) ,1 / 6)
print(zmienna1)
zmienna2 = math.floor(3.55)
print(zmienna2)
zmienna3 = math.ceil(4.80)
print(zmienna3)

# ZADANIE 5
imie = "NIKODEM"
nazwisko = "DYZMA"
print("\n" + str.capitalize(imie) + " " + str.capitalize(nazwisko))

# ZADANIE 6
tekst = """Just a small town girl
Livin' in a lonely world
She took the midnight train goin' anywhere
Just a city boy
Born and raised in south Detroit
He took the midnight train goin' anywhere
A singer in a smoky room
A smell of wine and cheap perfume
For a smile they can share the night
It goes on and on, and on, and on
Strangers waiting
Up and down the boulevard
Their shadows searching in the night
Streetlights, people
Living just to find emotion
Hiding somewhere in the night
Working hard to get my fill
Everybody wants a thrill
Payin' anything to roll the dice
Just one more time
Some will win, some will lose
Some were born to sing the blues
Oh, the movie never ends
It goes on and on, and on, and on
Strangers waiting
Up and down the boulevard
Their shadows searching in the night
Streetlights, people
Living just to find emotion
Hiding somewhere in the night
Don't stop believin'
Hold on to the feelin'
Streetlights, people
Don't stop believin'
Hold on
Streetlights, people
Don't stop believin'
Hold on to the feelin'
Streetlights, people"""
print("\n" + str(str.count(tekst, "goin'")))

# ZADANIE 7
tab = "Streetlights"
print("\n" + tab[1] + " " + tab[len(tab) - 1])

# ZADANIE 8
print(str.split(tekst))

# ZADANIE 9
zmienna1 = "String"
zmienna2 = 2.2222
zmienna3 = 0x4f
print('%(z1)s, %(z2)d, %(z3)d' %{'z1':zmienna1, 'z2':zmienna2, 'z3':zmienna3})

# ZADANIE 10
lista = ["Powwrót do przyszłości", 'Dzień Świstaka', 'Diabeł ubiera się u Prady']
lista.sort()
print('\n' + str(lista))

# ZADANIE 11
sin = [round(math.sin(0)),
round(math.sin(math.pi / 6), 1),
round(math.sin(math.pi / 4), 7),
round(math.sin(math.pi / 3), 7),
round(math.sin(math.pi / 2))]
cos = [round(math.cos(0)),
round(math.cos(math.pi / 6), 7),
round(math.cos(math.pi / 4), 7),
round(math.cos(math.pi / 3), 1),
round(math.cos(math.pi / 2))]
tan = [round(math.tan(0)),
round(math.tan(math.pi / 6), 7),
round(math.tan(math.pi / 4), 1),
round(math.tan(math.pi / 3), 7),
"NIE ISTNIEJE"]
ctan = tan.copy()
ctan.reverse()
print(sin)
print(cos)
print(tan)
print(ctan)

185 changes: 185 additions & 0 deletions cw_10.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import random

# ZADANIE 1
# ZADANIE 2
x = np.linspace(1, 19, 20)
plt.axis([0, 20, 0, 1])
plt.plot(x, 1/x, 'g>:',label = 'f(x) = 1/x')
plt.xlabel('x')
plt.ylabel('f(x)')
plt.title('Wykres funkcji f(x) dla x [1, 20]')
plt.legend()
plt.show()

# ZADANIE 3
x = np.arange(0.0, 30.0, 0.1)
plt.plot(x, np.sin(x), 'violet', label = 'f(x) = sin(x)')
plt.plot(x, np.cos(x), 'orange', label = 'f(x) = cos(x)')
plt.xlabel('x')
plt.ylabel('f(x)')
plt.title('Wykres funkcji sin(x) i cos(x) dla x [0, 30]')
plt.legend()
plt.show()

# ZADANIE 4
x = np.arange(0.0, 30.0, 0.1)
plt.plot(x, 2 + np.sin(x), 'blue', label = 'sin(x)')
plt.plot(x, -np.sin(x), 'orange', label = 'sin(x)')
plt.xlabel('x')
plt.ylabel('sin(x)')
plt.title('Wykres sin(x), sin(x)')
plt.legend(loc = 'center left')
plt.show()

# ZADANIE 5


# ZADANIE 6
df = pd.read_csv('Imiona_nadane_wPolsce_w_latach_2000-2019.csv', header=0, sep=',')

# # A
# m = df.groupby(["Płeć"]).agg({"Liczba":["sum"]})
# milan = m["Liczba"]["sum"]
# fig, ax = plt.subplots()
# index = np.arange(2)
# bar_width = 0.75
# ax.bar(index, milan, bar_width, color='lightblue')
# ax.set_xlabel('Lata')
# ax.set_ylabel('Liczba narodzin')
# ax.set_title("Liczba narodzin dzieci w lata 2000-2019 z podziałem zewzględu na płeć")
# ax.set_xticks(index)
# ax.set_xticklabels(("Kobiety", "Mężczyźni"), rotation = 45)
# plt.show()

# # B
# # WERSJA ALTERNATYWNA
# m = df.groupby(["Płeć", "Rok"]).agg({"Liczba": ["sum"]})
# milan = m["Liczba"]["sum"]["K"]
# inter = m["Liczba"]["sum"]["M"]
# fig, ax = plt.subplots()
# index = np.arange(20)
# bar_width = 0.3
# ax.bar(index, milan, bar_width, color='pink', label='Kobiety')
# ax.bar(index + bar_width, inter, bar_width, color='lightblue', label='Mężczyźni')
# ax.set_xlabel('Lata')
# ax.set_ylabel('Liczba narodzin')
# ax.set_title("Roczna liczba narodzin dzieci w lata 2000-2019 z podziałem ze względu na płeć")
# ax.set_xticks(index + bar_width / 2)
# ax.set_xticklabels(("2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011",
# "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019"), rotation = 45)
# ax.legend()
# plt.show()
#
# # B
# m = df.groupby(["Płeć", "Rok"]).agg({"Liczba": ["sum"]})
# x = ["2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013",
# "2014", "2015", "2016", "2017", "2018", "2019"]
# y = np.arange(2000, 2020, 1)
# milan = m["Liczba"]["sum"]["K"]
# inter = m["Liczba"]["sum"]["M"]
# plt.plot(x, milan[y], 'pink', label='Kobiety')
# plt.plot(x, inter[y], 'lightblue', label='Mężczyźni')
# plt.xlabel("Lata")
# plt.ylabel('Liczba narodzin')
# plt.xticks(rotation=45)
# plt.title('Roczna liczba narodzin dzieci w lata 2000-2019 z podziałem ze względu na płeć')
# plt.legend()
# plt.show()

# # C
# m = df.groupby(["Rok"]).agg({"Liczba": ["sum"]})
# milan = m["Liczba"]["sum"]
# fig, ax = plt.subplots()
# index = np.arange(20)
# bar_width = 0.3
# ax.bar(index, milan, bar_width, color='lightblue')
# ax.set_xlabel('Lata')
# ax.set_ylabel('Liczba narodzin')
# ax.set_title("Roczna liczba narodzin dzieci w lata 2000-2019")
# ax.set_xticks(index)
# ax.set_xticklabels(("2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011",
# "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019"), rotation = 45)
# plt.show()

# A
plt.subplot(1, 3, 1)
m = df.groupby(["Płeć"]).agg({"Liczba":["sum"]})
plt.bar(["Kobieta", "Mężczyna"], m["Liczba"]["sum"], color = 'darkgreen')
plt.ylabel('Liczba narodzin')
plt.xlabel("Płeć")

# B
plt.subplot(1, 3, 2)
m = df.groupby(["Płeć", "Rok"]).agg({"Liczba": ["sum"]})
x = ["2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013",
"2014", "2015", "2016", "2017", "2018", "2019"]
y = np.arange(2000, 2020, 1)
milan = m["Liczba"]["sum"]["K"]
inter = m["Liczba"]["sum"]["M"]
plt.plot(x, milan[y], 'pink', label='Kobiety')
plt.plot(x, inter[y], 'lightblue', label='Mężczyźni')
plt.xticks(rotation=45)
plt.xlabel("Lata")
plt.ylabel('Liczba narodzin')
plt.legend()

# C
plt.subplot(1, 3, 3)
m = df.groupby(["Rok"]).agg({"Liczba": ["sum"]})
x = ["2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013",
"2014", "2015", "2016", "2017", "2018", "2019"]
plt.bar(x, m["Liczba"]["sum"], color = 'darkorange')
plt.xticks(rotation=45)
plt.xlabel("Lata")
plt.ylabel('Liczba narodzin')
plt.show()

# ZADANIE 7
df = pd.read_csv('Imiona_nadane_wPolsce_w_latach_2000-2019.csv', header=0, sep=',')
m = df.groupby(["Płeć", "Rok"]).agg({"Liczba": ["sum"]})
x = ["2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013",
"2014", "2015", "2016", "2017", "2018", "2019"]
y = np.arange(2000, 2020, 1)
milan = m["Liczba"]["sum"]["K"]
inter = m["Liczba"]["sum"]["M"]
plt.bar(x, milan, width=0.3, color="darkblue", label='Kobiety')
plt.bar(x, inter, width=0.3, color="darkred", label='Mężczyźni', bottom=milan)
plt.xticks(rotation=45)
plt.xlabel("Lata")
plt.ylabel('Liczba narodzin')
plt.legend(loc = 2)
plt.show()

# ZADNIE 8
def rzucaj(n):
lista = []
for x in range(n):
lista.append(random.randint(1,6) + random.randint(1,6))
return lista
n = int(input("Podaj liczbę rzutów dwiema kostkami k6: "))
x = rzucaj(n)
plt.hist(x , bins=50, facecolor='g', alpha=0.75, density=True)
plt.grid(True)
plt.xlabel("Wartości")
plt.ylabel("Prawdopodobieństwo")
plt.title("Histogram")
plt.show()

# ZADANIE 9
df = pd.read_csv('zamowienia.csv', header=0, sep=';')
m = df.groupby(["Sprzedawca"]).agg({"Utarg": ["sum"]})
df = df.groupby(["Sprzedawca"]).agg({"Sprzedawca": ["max"]})
explode = np.zeros(len(m["Utarg"]["sum"]))
explode[m["Utarg"]["sum"].argmax()] = 0.1
color = ["rosybrown", "sienna", "tan", "darkkhaki", "palegreen", "lightseagreen", "deepskyblue", "royalblue",
"mediumpurple"]
plt.pie(m["Utarg"]["sum"], labels=df["Sprzedawca"]["max"], colors=color, startangle=170, autopct="%1.1f%%",
explode=explode)
plt.legend(loc="best", ncol=3)
plt.title("Procentawy udział sprzedawców w obrocie firmy")
plt.show()

# ZADANIE 10
Loading