Last active
May 15, 2021 08:50
-
-
Save ngbala6/211ac319126530e042072a9491d365b2 to your computer and use it in GitHub Desktop.
Revisions
-
ngbala6 revised this gist
May 15, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -87,7 +87,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ "### Using statistics package" ] }, { -
ngbala6 created this gist
May 15, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,139 @@ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Import Packages" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "import statistics\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Sample Data" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "data = [1,2,4,5,6,76,8,45]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Using Formula without Python Packages" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "18.375\n" ] } ], "source": [ "mean = sum(data)/len(data)\n", "\n", "print(mean)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Using numpy package" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "18.375\n" ] } ], "source": [ "print(np.mean(data))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Using Statistics package" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "18.375\n" ] } ], "source": [ "print(statistics.mean(data))" ] }, { "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.4" } }, "nbformat": 4, "nbformat_minor": 4 }