Skip to content

Instantly share code, notes, and snippets.

@flyfir248
Created July 19, 2022 12:30
Show Gist options
  • Save flyfir248/740356d7fea9de964074f4ebc8d81442 to your computer and use it in GitHub Desktop.
Save flyfir248/740356d7fea9de964074f4ebc8d81442 to your computer and use it in GitHub Desktop.
Website Notebook Classwork 4.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Website Notebook Classwork 4.ipynb",
"provenance": [],
"authorship_tag": "ABX9TyPyR/kn906u+RAflOtixvq6",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/flyfir248/740356d7fea9de964074f4ebc8d81442/website-notebook-classwork-4.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "dLPbS_bNbtxB",
"outputId": "c1d9b38c-2629-4fcd-81bd-17bbb3266e1d"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[[ 0 1 2 3 4]\n",
" [ 5 6 7 8 9]\n",
" [10 11 12 13 14]\n",
" [15 16 17 18 19]\n",
" [20 21 22 23 24]]\n"
]
}
],
"source": [
"import numpy as np\n",
"\n",
"Array2D = np.arange(0, 25).reshape([5,5])\n",
"\n",
"print(Array2D)"
]
},
{
"cell_type": "code",
"source": [
"np.mean(Array2D, axis = 1)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "Mek_16p-b594",
"outputId": "cae49e5a-032a-43f2-cd57-11a1259d0486"
},
"execution_count": 2,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array([ 2., 7., 12., 17., 22.])"
]
},
"metadata": {},
"execution_count": 2
}
]
},
{
"cell_type": "code",
"source": [
"np.mean(Array2D, axis = 0)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "nfA-bE_Ob7II",
"outputId": "f8d827a0-bc56-4184-ef6f-9fde0abf7ef9"
},
"execution_count": 3,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array([10., 11., 12., 13., 14.])"
]
},
"metadata": {},
"execution_count": 3
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment