Skip to content

Instantly share code, notes, and snippets.

@flyfir248
Created July 19, 2022 11:39
Show Gist options
  • Save flyfir248/5c66933069198742dea77c0140e59e7a to your computer and use it in GitHub Desktop.
Save flyfir248/5c66933069198742dea77c0140e59e7a to your computer and use it in GitHub Desktop.
Website Notebook Classwork.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Website Notebook Classwork.ipynb",
"provenance": [],
"authorship_tag": "ABX9TyMeel7SWbi/ys5PolbGFNFy",
"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/5c66933069198742dea77c0140e59e7a/website-notebook-classwork.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "5f4tXg2zORYL",
"outputId": "0e5024af-9bb1-4242-d395-0d23306f261e"
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"3"
]
},
"metadata": {},
"execution_count": 9
}
],
"source": [
"import numpy as np\n",
"\n",
"np.sum([1, 2])"
]
},
{
"cell_type": "code",
"source": [
"np.sum([1, 2, 3, 4], dtype=np.int32)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "f1Sl8ntJPBVM",
"outputId": "9eb77089-7f64-4d84-e1cc-b7d5e2eeb2b2"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"10"
]
},
"metadata": {},
"execution_count": 10
}
]
},
{
"cell_type": "code",
"source": [
"np.sum([[4, 5], [7, 8]])"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "IqnwiFBMPKEF",
"outputId": "664cca76-c596-4e03-cf51-5f72ef2b231c"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"24"
]
},
"metadata": {},
"execution_count": 11
}
]
},
{
"cell_type": "code",
"source": [
"np.sum([[11, 12], [12, 13]], axis=0)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "D4-XSs4xPME0",
"outputId": "83473e63-1e4e-46e6-fa08-9410beb427dc"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array([23, 25])"
]
},
"metadata": {},
"execution_count": 12
}
]
},
{
"cell_type": "code",
"source": [
"np.sum([[0, 1], [0, 5]], axis=1)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "8sFmXDz_PN30",
"outputId": "e96a7d5e-031b-4af8-d4c5-783940770450"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array([1, 5])"
]
},
"metadata": {},
"execution_count": 13
}
]
},
{
"cell_type": "code",
"source": [
"np.sum([[0, 1], [np.nan, 7]], where=[False, True], axis=1)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "igTljb7tPP8z",
"outputId": "1c245fdd-f0b5-4a13-a210-5bd27f7ac966"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array([1., 7.])"
]
},
"metadata": {},
"execution_count": 14
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment