diff --git a/module-1/lab-intro-pandas/your-code/main.ipynb b/module-1/lab-intro-pandas/your-code/main.ipynb index 03f020a38..1443924d6 100644 --- a/module-1/lab-intro-pandas/your-code/main.ipynb +++ b/module-1/lab-intro-pandas/your-code/main.ipynb @@ -18,10 +18,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "import numpy as np\n", + "import pandas as pd" + ] }, { "cell_type": "markdown", @@ -32,7 +35,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -41,10 +44,31 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0 5.7\n", + "1 75.2\n", + "2 74.4\n", + "3 84.0\n", + "4 66.5\n", + "5 66.3\n", + "6 55.8\n", + "7 75.7\n", + "8 29.1\n", + "9 43.7\n", + "dtype: float64\n" + ] + } + ], + "source": [ + "pd_series = pd.Series(lst)\n", + "print(pd_series)" + ] }, { "cell_type": "markdown", @@ -57,10 +81,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "74.4\n" + ] + } + ], + "source": [ + "pd_series[2]" + ] }, { "cell_type": "markdown", @@ -71,7 +105,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -89,10 +123,30 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " 0 1 2 3 4\n", + "0 53.1 95.0 67.5 35.0 78.4\n", + "1 61.3 40.8 30.8 37.8 87.6\n", + "2 20.6 73.2 44.2 14.6 91.8\n", + "3 57.4 0.1 96.1 4.2 69.5\n", + "4 83.6 20.5 85.4 22.8 35.9\n", + "5 49.0 69.0 0.1 31.8 89.1\n", + "6 23.3 40.7 95.0 83.8 26.9\n", + "7 27.6 26.4 53.8 88.8 68.5\n", + "8 96.6 96.4 53.4 72.4 50.1\n", + "9 73.7 39.0 43.2 81.6 34.7\n" + ] + } + ], + "source": [ + "pd_df = pd.DataFrame(b)" + ] }, { "cell_type": "markdown", @@ -103,7 +157,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -112,10 +166,30 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Score_1 Score_2 Score_3 Score_4 Score_5\n", + "0 53.1 95.0 67.5 35.0 78.4\n", + "1 61.3 40.8 30.8 37.8 87.6\n", + "2 20.6 73.2 44.2 14.6 91.8\n", + "3 57.4 0.1 96.1 4.2 69.5\n", + "4 83.6 20.5 85.4 22.8 35.9\n", + "5 49.0 69.0 0.1 31.8 89.1\n", + "6 23.3 40.7 95.0 83.8 26.9\n", + "7 27.6 26.4 53.8 88.8 68.5\n", + "8 96.6 96.4 53.4 72.4 50.1\n", + "9 73.7 39.0 43.2 81.6 34.7\n" + ] + } + ], + "source": [ + "pd_df.columns = colnames" + ] }, { "cell_type": "markdown", @@ -126,10 +200,30 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Score_1 Score_3 Score_5\n", + "0 53.1 67.5 78.4\n", + "1 61.3 30.8 87.6\n", + "2 20.6 44.2 91.8\n", + "3 57.4 96.1 69.5\n", + "4 83.6 85.4 35.9\n", + "5 49.0 0.1 89.1\n", + "6 23.3 95.0 26.9\n", + "7 27.6 53.8 68.5\n", + "8 96.6 53.4 50.1\n", + "9 73.7 43.2 34.7\n" + ] + } + ], + "source": [ + "pd_df_subset135 = pd_df[['Score_1','Score_3','Score_5']]" + ] }, { "cell_type": "markdown", @@ -140,10 +234,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Score_3 56.95\n", + "dtype: float64\n" + ] + } + ], + "source": [ + "pd_df_Sc3_mean = pd_df[['Score_3']].mean()" + ] }, { "cell_type": "markdown", @@ -154,10 +259,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Score_4 88.8\n", + "dtype: float64\n" + ] + } + ], + "source": [ + "pd_df_Sc4_max = pd_df[['Score_4']].max()" + ] }, { "cell_type": "markdown", @@ -168,10 +284,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Score_2 40.75\n", + "dtype: float64\n" + ] + } + ], + "source": [ + "pd_df_Sc2_median = pd_df[['Score_2']].median()" + ] }, { "cell_type": "markdown", @@ -182,7 +309,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -203,10 +330,30 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Description Quantity Revenue UnitPrice\n", + "0 LUNCH BAG APPLE DESIGN 1 1.65 1.65\n", + "1 SET OF 60 VINTAGE LEAF CAKE CASES 24 13.20 0.55\n", + "2 RIBBON REEL STRIPES DESIGN 1 1.65 1.65\n", + "3 WORLD WAR 2 GLIDERS ASSTD DESIGNS 2880 518.40 0.18\n", + "4 PLAYING CARDS JUBILEE UNION JACK 2 2.50 1.25\n", + "5 POPCORN HOLDER 7 5.95 0.85\n", + "6 BOX OF VINTAGE ALPHABET BLOCKS 1 11.95 11.95\n", + "7 PARTY BUNTING 4 19.80 4.95\n", + "8 JAZZ HEARTS ADDRESS BOOK 10 1.90 0.19\n", + "9 SET OF 4 SANTA PLACE SETTINGS 48 60.00 1.25\n" + ] + } + ], + "source": [ + "df_orders = pd.DataFrame(orders)" + ] }, { "cell_type": "markdown", @@ -217,10 +364,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "total_quantity = df_orders['Quantity'].sum()\n", + "total_revenue = df_orders['Revenue'].sum()" + ] }, { "cell_type": "markdown", @@ -231,10 +381,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 35, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "11.77\n" + ] + } + ], + "source": [ + "most_expensive = df_orders['UnitPrice'].max()\n", + "least_expensive = df_orders['UnitPrice'].min()\n", + "difference = most_expensive - least_expensive\n", + "print(difference)" + ] } ], "metadata": { @@ -253,7 +416,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.0" + "version": "3.6.8" } }, "nbformat": 4, diff --git a/module-1/lab-mysql/your-code/create.sql b/module-1/lab-mysql/your-code/create.sql new file mode 100644 index 000000000..d11db7343 --- /dev/null +++ b/module-1/lab-mysql/your-code/create.sql @@ -0,0 +1,37 @@ +USE lab_mysql; + +CREATE TABLE Cars ( + VIN VARCHAR(255), + Manufacturer VARCHAR(255), + Model VARCHAR(255), + Year INT, + Color VARCHAR(255), + PRIMARY KEY (VIN) +); + +CREATE TABLE Customers ( + CustomerID VARCHAR(255), + Name VARCHAR(255), + PhoneNumber VARCHAR(255), + Email VARCHAR(255), + Address VARCHAR(255), + Country VARCHAR(255), + PRIMARY KEY (CustomerID) +); + +CREATE TABLE Salesperson ( + StaffID VARCHAR(255), + Name VARCHAR(255), + Store VARCHAR(255), + PRIMARY KEY (StaffID) +); + +CREATE TABLE Invoice ( + InvoiceNR INT, + Date DATE, + PRIMARY KEY (InvoiceNR), + VIN VARCHAR (255) REFERENCES Cars(VIN), + CustomerID VARCHAR (255) REFERENCES Customers(CustomerID), + SalespersonID VARCHAR (255) REFERENCES Salesperson(StaffID) +); + \ No newline at end of file diff --git a/module-1/lab-mysql/your-code/delete.sql b/module-1/lab-mysql/your-code/delete.sql new file mode 100644 index 000000000..dc1620a4a --- /dev/null +++ b/module-1/lab-mysql/your-code/delete.sql @@ -0,0 +1,4 @@ +DELETE FROM Cars +WHERE + VIN = '3K096I98581DHSNUP'; + diff --git a/module-1/lab-mysql/your-code/seeding.sql b/module-1/lab-mysql/your-code/seeding.sql new file mode 100644 index 000000000..dc5d1d25e --- /dev/null +++ b/module-1/lab-mysql/your-code/seeding.sql @@ -0,0 +1,27 @@ +USE lab_mysql; + +SELECT * FROM Cars; + +INSERT INTO Cars VALUES ('3K096I98581DHSNUP','Volkswagen','Tiguan',2019,'Blue'); +INSERT INTO Cars VALUES ('ZM8G7BEUQZ97IH46V','Peugeot','Rifter',2019,'Red'); +INSERT INTO Cars VALUES ('RKXVNNIHLVVZOUB4M','Ford','Fusion',2018,'White'); +INSERT INTO Cars VALUES ('HKNDGS7CU31E9Z7JW','Toyota','RAV4',2018,'Silver'); + +SELECT * FROM Customers; + +INSERT INTO Customers VALUES ('10001','Pablo Picasso','+34 636 17 63 82','','Paseo de la Chopera, 14','Spain'); +INSERT INTO Customers VALUES ('20001','Abraham Lincoln','+1 305 907 7086','','120 SW 8th St','United States'); +INSERT INTO Customers VALUES ('30001','Napoléon Bonaparte','+33 1 79 75 40 00','','- 40 Rue du Colisée','France'); + +SalespersonSalespersonSELECT * FROM Salesperson; + +INSERT INTO Salesperson VALUES ('0','00001','Petey Cruiser','Madri'); +INSERT INTO Salesperson VALUES ('1','00002','Anna Sthesia','Barcelona'); +INSERT INTO Salesperson VALUES ('2','00003','Paul Molive','Berlin'); +INSERT INTO Salesperson VALUES ('3 ','00004','Gail Forcewind','Paris'); + +SELECT * FROM Invoice; + +INSERT INTO Invoice VALUES ('0',852399038,22-08-2018,0,1,3); +INSERT INTO Invoice VALUES ('1',731166526,31-12-2018,3,0,5); +INSERT INTO Invoice VALUES ('2',271135104,22-01-2019,2,2,7); \ No newline at end of file diff --git a/module-1/lab-mysql/your-code/update.sql b/module-1/lab-mysql/your-code/update.sql new file mode 100644 index 000000000..5cce8c57a --- /dev/null +++ b/module-1/lab-mysql/your-code/update.sql @@ -0,0 +1,23 @@ +UPDATE Salesperson +SET + Store = 'Madrid' +WHERE + StaffID = 0; + +UPDATE Customers +SET + Email = 'ppicasso@gmail.com' +WHERE + CustomerID = 10001; + +UPDATE Customers +SET + Email = 'lincoln@us.gov' +WHERE + CustomerID = 20001; + +UPDATE Customers +SET + Email = 'hello@napoleon.me' +WHERE + CustomerID = 30001; diff --git a/module-1/lab-numpy/your-code/main.py b/module-1/lab-numpy/your-code/main.py index 78c792b74..cfa7607da 100644 --- a/module-1/lab-numpy/your-code/main.py +++ b/module-1/lab-numpy/your-code/main.py @@ -1,68 +1,74 @@ -#1. Import the NUMPY package under the name np. +# 1. Import the NUMPY package under the name np. +import numpy as np +# 2. Print the NUMPY version and the configuration. -#2. Print the NUMPY version and the configuration. - - -#3. Generate a 2x3x5 3-dimensional array with random values. Assign the array to variable "a" +# 3. Generate a 2x3x5 3-dimensional array with random values. Assign the array to variable "a" # Challenge: there are at least three easy ways that use numpy to generate random arrays. How many ways can you find? +a = np.random.random((2, 3, 5)) +# 4. Print a. -#4. Print a. - - - -#5. Create a 5x2x3 3-dimensional array with all values equaling 1. -#Assign the array to variable "b" - - - -#6. Print b. +# print(a) +# 5. Create a 5x2x3 3-dimensional array with all values equaling 1. +# Assign the array to variable "b" +b = np.ones((5, 2, 3)) -#7. Do a and b have the same size? How do you prove that in Python code? +# 6. Print b. +# print(b) +# 7. Do a and b have the same size? How do you prove that in Python code? +print(a != b) +# This prints True, meaning a is different from b -#8. Are you able to add a and b? Why or why not? +# 8. Are you able to add a and b? Why or why not? +# NO. You can only add two arrays if they have the same dimensions, which is not the case the operation a+b will throw an error -#9. Transpose b so that it has the same structure of a (i.e. become a 2x3x5 array). Assign the transposed array to varialbe "c". +# 9. Transpose b so that it has the same structure of a (i.e. become a 2x3x5 array). Assign the transposed array to varialbe "c". +c = np.transpose(b) +print(c) +a_tranposed = np.transpose(a) -#10. Try to add a and c. Now it should work. Assign the sum to varialbe "d". But why does it work now? +# 10. Try to add a and c. Now it should work. Assign the sum to varialbe "d". But why does it work now? +d = a + c +print(d) +# Yes because now the dimensions match -#11. Print a and d. Notice the difference and relation of the two array in terms of the values? Explain. +# 11. Print a and d. Notice the difference and relation of the two array in terms of the values? Explain. +# all the values are summed toggether individually -#12. Multiply a and c. Assign the result to e. +# 12. Multiply a and c. Assign the result to e. +# 13. Does e equal to a? Why or why not? -#13. Does e equal to a? Why or why not? +# yes but only because it is multiplying all the values for one which doesn't provoke any change +# 14. Identify the max, min, and mean values in d. Assign those values to variables "d_max", "d_min", and "d_mean" - -#14. Identify the max, min, and mean values in d. Assign those values to variables "d_max", "d_min", and "d_mean" - - - - -#15. Now we want to label the values in d. First create an empty array "f" with the same shape (i.e. 2x3x5) as d using `np.empty`. +# d_max = +# d_min = +# d_mean = +# 15. Now we want to label the values in d. First create an empty array "f" with the same shape (i.e. 2x3x5) as d using `np.empty`. """ @@ -76,8 +82,6 @@ """ - - """ #17. Print d and f. Do you have your expected f? For instance, if your d is: @@ -111,4 +115,4 @@ [ 'D', 'D', 'D', 'D', 'D'], [ 'B', 'D', 'A', 'D', 'D']]]) Again, you don't need Numpy in this question. -""" \ No newline at end of file +""" diff --git a/module-1/lab-resolving-git-conflicts/your-code/about-me.md b/module-1/lab-resolving-git-conflicts/your-code/about-me.md index 30a999d50..3d119b0c6 100644 --- a/module-1/lab-resolving-git-conflicts/your-code/about-me.md +++ b/module-1/lab-resolving-git-conflicts/your-code/about-me.md @@ -1,7 +1,3 @@ -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque viverra laoreet lorem et dapibus. Integer auctor dignissim egestas. Ut id purus neque. Pellentesque imperdiet lacus in libero laoreet, at tempus felis tristique. Cras fermentum erat a dui vulputate gravida. Nulla aliquet nisi interdum nulla pretium, ac vestibulum diam congue. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus lacus risus, sodales vitae viverra quis, maximus ac ipsum. Sed consequat viverra mattis. Curabitur iaculis varius mollis. +Carla is a passionate, honest, web developer musician and financier. Learning the new tech world lingo and pursuing all passions while trying to watch all the top 250 movies she can find. -Ut porttitor iaculis tellus bibendum euismod. Morbi porta, ante nec tempus porta, felis mi faucibus lacus, sed tristique purus nunc sed est. Aenean pulvinar urna ut lacus interdum aliquam. Pellentesque sit amet magna accumsan, sagittis metus a, volutpat velit. Mauris vitae ex vehicula, posuere nisi sed, sagittis nunc. Ut scelerisque, mi non tristique tristique, mi enim luctus nunc, eu mattis sem quam auctor nunc. Donec lobortis tellus eget blandit ultricies. Vivamus euismod metus eget leo blandit, at malesuada magna efficitur. Praesent sodales faucibus mi, ullamcorper ultrices orci. Vivamus maximus malesuada massa, nec placerat leo feugiat vel. Nam vitae eleifend enim. Nullam interdum ipsum velit, vitae faucibus lectus blandit euismod. - -Suspendisse ut malesuada ex. Nulla ultricies nisl et nisi rhoncus sollicitudin. Vestibulum maximus iaculis ligula, nec commodo nunc ullamcorper nec. Duis quis condimentum sapien. Cras vestibulum interdum felis eu auctor. Quisque semper, magna at dapibus faucibus, felis risus semper ligula, id aliquam lectus ligula vel nisi. In hac habitasse platea dictumst. Donec arcu sapien, suscipit ac dictum et, imperdiet id tortor. Maecenas ornare sodales interdum. Mauris dictum felis eu eros vestibulum cursus. Phasellus accumsan, turpis ut malesuada sollicitudin, augue leo venenatis ante, vel convallis tellus diam sit amet lacus. Aenean eu mauris eros. Praesent ante lacus, gravida sit amet tellus nec, laoreet ultrices lacus. Integer commodo semper vestibulum. Fusce felis massa, consectetur facilisis rutrum nec, pulvinar et nisi. - -Morbi fermentum ultricies tortor, vehicula ultrices eros elementum a. Duis ornare aliquam facilisis. Proin aliquam tincidunt odio vitae dignissim. Sed malesuada lacinia massa, nec blandit urna auctor elementum. Duis auctor non tortor in consequat. Mauris id vestibulum risus. In eget erat sed lacus efficitur viverra sed eu est. Aliquam interdum consequat molestie. Aliquam metus nisi, blandit non semper ut, blandit vel leo. Cras dictum turpis erat, sed iaculis ligula facilisis dapibus. Aliquam posuere dignissim fermentum. Praesent at neque sit amet lectus ornare iaculis. Curabitur id urna quis lorem varius ultrices eu sit amet sapien. Curabitur maximus volutpat suscipit. Proin imperdiet elementum lacus a eleifend. Sed tempor lacus posuere diam vehicula iaculis. +---Adding changes to provoke a conflict---