Skip to content
1 change: 1 addition & 0 deletions contributors/segundev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Jayeola Gbenga
1 change: 0 additions & 1 deletion contributors/yabebalFantaye.txt

This file was deleted.

308 changes: 308 additions & 0 deletions twitter_mining/Challenge_Distribution.ipynb

Large diffs are not rendered by default.

276 changes: 276 additions & 0 deletions twitter_mining/Chanllenge_Hypothesis_Testing.ipynb

Large diffs are not rendered by default.

323 changes: 323 additions & 0 deletions twitter_mining/Matplotlib Task.ipynb

Large diffs are not rendered by default.

268 changes: 268 additions & 0 deletions twitter_mining/Numpy Task.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Numpy Tasks"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Task_1"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Question 1. Create a numpy array with 6X5 2D array from 10 upwards"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[10, 11, 12, 13, 14],\n",
" [15, 16, 17, 18, 19],\n",
" [20, 21, 22, 23, 24],\n",
" [25, 26, 27, 28, 29],\n",
" [30, 31, 32, 33, 34],\n",
" [35, 36, 37, 38, 39]])"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import numpy as np\n",
"\n",
"array = np.arange(10,40).reshape(6,5)\n",
"array"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Question 2. From question 1, reshape the numpy array to any shape of your choice and return the max value from each column."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([30, 31, 32, 33, 34, 35, 36, 37, 38, 39])"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"array.reshape(3,10).max(axis=0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Question 3. Create a numpy array A with np.ones with a shape of (3,4). Create another array using the np.arange with a shape of (3,4). "
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 0, 1, 2, 3],\n",
" [ 4, 5, 6, 7],\n",
" [ 8, 9, 10, 11]])"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"array1 = np.ones((3,4))\n",
"array2 = np.arange(12).reshape(3,4)\n",
"array2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Question 4. Perform arithmetic operations (+,-,*,/) on the two arrays from question 3."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The addition of both arrays \n",
" [[ 1. 2. 3. 4.]\n",
" [ 5. 6. 7. 8.]\n",
" [ 9. 10. 11. 12.]]\n",
"\n",
"+++++++++++++++++++++++++++++++++\n",
"\n",
"The difference of both arrays \n",
" [[ 1. 0. -1. -2.]\n",
" [ -3. -4. -5. -6.]\n",
" [ -7. -8. -9. -10.]]\n",
"\n",
"+++++++++++++++++++++++++++++++++\n",
"\n",
"The product of both arrays \n",
" [[ 0. 1. 2. 3.]\n",
" [ 4. 5. 6. 7.]\n",
" [ 8. 9. 10. 11.]]\n",
"\n",
"+++++++++++++++++++++++++++++++++\n",
"\n",
"The division of both arrays \n",
" [[ inf 1. 0.5 0.33333333]\n",
" [0.25 0.2 0.16666667 0.14285714]\n",
" [0.125 0.11111111 0.1 0.09090909]]\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\user\\anaconda3\\lib\\site-packages\\ipykernel_launcher.py:4: RuntimeWarning: divide by zero encountered in true_divide\n",
" after removing the cwd from sys.path.\n"
]
}
],
"source": [
"add = array1 + array2\n",
"diff = array1 - array2\n",
"prod = array1 * array2\n",
"div = array1 / array2\n",
"\n",
"print('The addition of both arrays \\n', add)\n",
"print('\\n+++++++++++++++++++++++++++++++++\\n')\n",
"print('The difference of both arrays \\n', diff)\n",
"print('\\n+++++++++++++++++++++++++++++++++\\n')\n",
"print('The product of both arrays \\n', prod)\n",
"print('\\n+++++++++++++++++++++++++++++++++\\n')\n",
"print('The division of both arrays \\n', div)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Question 5. From question 4, transpose the results of each arithmetic operation."
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The transpose of the arrays addition \n",
" [[ 1. 5. 9.]\n",
" [ 2. 6. 10.]\n",
" [ 3. 7. 11.]\n",
" [ 4. 8. 12.]]\n",
"\n",
"+++++++++++++++++++++++++++++++++\n",
"\n",
"The transpose of the arrays difference \n",
" [[ 1. -3. -7.]\n",
" [ 0. -4. -8.]\n",
" [ -1. -5. -9.]\n",
" [ -2. -6. -10.]]\n",
"\n",
"+++++++++++++++++++++++++++++++++\n",
"\n",
"The transpose of the arrays multiplication \n",
" [[ 0. 4. 8.]\n",
" [ 1. 5. 9.]\n",
" [ 2. 6. 10.]\n",
" [ 3. 7. 11.]]\n",
"\n",
"+++++++++++++++++++++++++++++++++\n",
"\n",
"The transpose of the arrays division \n",
" [[ inf 0.25 0.125 ]\n",
" [1. 0.2 0.11111111]\n",
" [0.5 0.16666667 0.1 ]\n",
" [0.33333333 0.14285714 0.09090909]]\n",
"\n",
"+++++++++++++++++++++++++++++++++\n",
"\n"
]
}
],
"source": [
"print('The transpose of the arrays addition \\n', add.T)\n",
"print('\\n+++++++++++++++++++++++++++++++++\\n')\n",
"print('The transpose of the arrays difference \\n', diff.T)\n",
"print('\\n+++++++++++++++++++++++++++++++++\\n')\n",
"print('The transpose of the arrays multiplication \\n', prod.T)\n",
"print('\\n+++++++++++++++++++++++++++++++++\\n')\n",
"print('The transpose of the arrays division \\n', div.T)\n",
"print('\\n+++++++++++++++++++++++++++++++++\\n')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading