-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasic Python_61
1 lines (1 loc) · 5.63 KB
/
Basic Python_61
1
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"Basic Python_61","provenance":[],"collapsed_sections":[],"authorship_tag":"ABX9TyMh0y99RvYfto4rK0CqtN3v"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"markdown","source":["# Aim :- Basic Python Libraries\n"],"metadata":{"id":"Bq9-sjt21eIA"}},{"cell_type":"code","metadata":{"id":"d2o7jdWHXE6K","executionInfo":{"status":"ok","timestamp":1656697249154,"user_tz":-330,"elapsed":1336,"user":{"displayName":"Kirtee Shukla","userId":"17709531625105653447"}}},"source":["import numpy as np\n","import pandas as pd\n","import matplotlib.pyplot as plt\n","import seaborn as sns\n","from sklearn.model_selection import train_test_split\n","from sklearn.ensemble import RandomForestRegressor\n","from sklearn import metrics"],"execution_count":1,"outputs":[]},{"cell_type":"markdown","source":["# Basic Arithmetic Operations"],"metadata":{"id":"Ba7AssUc3Dp5"}},{"cell_type":"code","source":["first_arr = [1,2,3]\n","second_arr = [4,5,6]\n","sum = first_arr + second_arr\n","print(sum)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"spuOuv99298p","executionInfo":{"status":"ok","timestamp":1656697388933,"user_tz":-330,"elapsed":682,"user":{"displayName":"Kirtee Shukla","userId":"17709531625105653447"}},"outputId":"95f54821-79f7-4338-ceb6-cc6cb0f21afc"},"execution_count":2,"outputs":[{"output_type":"stream","name":"stdout","text":["[1, 2, 3, 4, 5, 6]\n"]}]},{"cell_type":"code","source":["first_num = [1,2,3,4]\n","second_num = [5,6,7,8]\n","diff = np.subtract(second_num,first_num)\n","print(diff)\n","mul = np.multiply(second_num,first_num)\n","print(mul)\n","div = np.divide(second_num,first_num)\n","print(div)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"h6N_45Oh3l-B","executionInfo":{"status":"ok","timestamp":1656697684648,"user_tz":-330,"elapsed":5,"user":{"displayName":"Kirtee Shukla","userId":"17709531625105653447"}},"outputId":"8a8fe272-3d73-435e-f8d1-e9299de6b4bd"},"execution_count":8,"outputs":[{"output_type":"stream","name":"stdout","text":["[4 4 4 4]\n","[ 5 12 21 32]\n","[5. 3. 2.33333333 2. ]\n"]}]},{"cell_type":"markdown","source":["# Basic Aggregate Functions"],"metadata":{"id":"PbM-c_hY4SvN"}},{"cell_type":"code","source":["arr = [1,2,3,4]\n","#To find the aggregate sum of the array\n","sum = np.sum(arr)\n","print(sum)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"G-mj4pkg4RD9","executionInfo":{"status":"ok","timestamp":1656697780031,"user_tz":-330,"elapsed":1719,"user":{"displayName":"Kirtee Shukla","userId":"17709531625105653447"}},"outputId":"195313b4-d1e3-4491-a2cb-1a0d2f07ad8a"},"execution_count":10,"outputs":[{"output_type":"stream","name":"stdout","text":["10\n"]}]},{"cell_type":"code","source":["#To find the minimum value in an array\n","min = np.min(arr)\n","print(min)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"GFS7nIeu4gDc","executionInfo":{"status":"ok","timestamp":1656697825741,"user_tz":-330,"elapsed":560,"user":{"displayName":"Kirtee Shukla","userId":"17709531625105653447"}},"outputId":"958bc486-a05c-498d-a7b2-c3e8e8999aa8"},"execution_count":13,"outputs":[{"output_type":"stream","name":"stdout","text":["1\n"]}]},{"cell_type":"code","source":["#To find the maximum value in the array\n","max = np.max(arr)\n","print(max)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"RK9ffNEt4rCj","executionInfo":{"status":"ok","timestamp":1656697851426,"user_tz":-330,"elapsed":9,"user":{"displayName":"Kirtee Shukla","userId":"17709531625105653447"}},"outputId":"51709b34-7993-4b0f-861f-1ad0fa27541d"},"execution_count":15,"outputs":[{"output_type":"stream","name":"stdout","text":["4\n"]}]},{"cell_type":"code","source":["#To find the mean value of the array\n","mean = np.mean(arr)\n","print(mean)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"EQYUcoXi4xx7","executionInfo":{"status":"ok","timestamp":1656697874934,"user_tz":-330,"elapsed":1114,"user":{"displayName":"Kirtee Shukla","userId":"17709531625105653447"}},"outputId":"801f0243-bc5d-4ea0-b3a8-06114ca684b3"},"execution_count":17,"outputs":[{"output_type":"stream","name":"stdout","text":["2.5\n"]}]},{"cell_type":"code","source":["#To find the median value of the array.\n","med = np.median(arr)\n","print(med)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"An89boLj43Sa","executionInfo":{"status":"ok","timestamp":1656697893199,"user_tz":-330,"elapsed":9,"user":{"displayName":"Kirtee Shukla","userId":"17709531625105653447"}},"outputId":"3ea01a38-7464-4ed0-e065-940baab4a99b"},"execution_count":18,"outputs":[{"output_type":"stream","name":"stdout","text":["2.5\n"]}]},{"cell_type":"code","source":["#To find the correaltion coefficiant \n","cor = np.corrcoef(arr)\n","print(cor)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"iCEGuPql48JT","executionInfo":{"status":"ok","timestamp":1656697917519,"user_tz":-330,"elapsed":11,"user":{"displayName":"Kirtee Shukla","userId":"17709531625105653447"}},"outputId":"73310930-f6dd-45f7-c4d7-3598f34c7e6b"},"execution_count":20,"outputs":[{"output_type":"stream","name":"stdout","text":["1.0\n"]}]},{"cell_type":"code","source":["#To find the standard deviation \n","std = np.std(arr)\n","print(std)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"safUDQy85Biz","executionInfo":{"status":"ok","timestamp":1656697941205,"user_tz":-330,"elapsed":5,"user":{"displayName":"Kirtee Shukla","userId":"17709531625105653447"}},"outputId":"b4885735-46ff-422b-a7b8-07248e44a4e2"},"execution_count":22,"outputs":[{"output_type":"stream","name":"stdout","text":["1.118033988749895\n"]}]}]}