Skip to content

Instantly share code, notes, and snippets.

@flyfir248
Created July 19, 2022 12:26
Show Gist options
  • Save flyfir248/23ac6bf6e9d9d8066802156e450c52aa to your computer and use it in GitHub Desktop.
Save flyfir248/23ac6bf6e9d9d8066802156e450c52aa to your computer and use it in GitHub Desktop.
Untitled1.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Untitled1.ipynb",
"provenance": [],
"authorship_tag": "ABX9TyOR+fxizy2d6XHQhI8bIt2K",
"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/23ac6bf6e9d9d8066802156e450c52aa/untitled1.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": "7iBClwC-a4UJ",
"outputId": "577f7e5e-16db-4eab-cd55-433e20617d7c"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[[0 1 2 3]\n",
" [4 5 6 7]]\n"
]
}
],
"source": [
"import numpy as np\n",
"\n",
"Array2D = np.arange(0, 8).reshape([2,4])\n",
"\n",
"print(Array2D)"
]
},
{
"cell_type": "code",
"source": [
"np.mean(Array2D, axis = 1)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "ptU0Y-03a9_5",
"outputId": "ced845da-94c6-4ab4-81ca-3387185eb9e7"
},
"execution_count": 2,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array([1.5, 5.5])"
]
},
"metadata": {},
"execution_count": 2
}
]
},
{
"cell_type": "code",
"source": [
"np.mean(Array2D, axis = 0)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "RV3-t8rZbDRI",
"outputId": "bb671b1d-55af-41e4-dab0-c4f5df06d27b"
},
"execution_count": 3,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array([2., 3., 4., 5.])"
]
},
"metadata": {},
"execution_count": 3
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment